Dynamic Systems:
Forced Response
Table of Contents
The system ${H}$ is a transformation (a rule or formula) that maps an input signal $x$ into a output signal $y$
System examples
$$ \begin{align*} &\text{Identity} \quad &y(t) &= x(t) \quad &\forall t\\ &\text{Scaling} \quad &y(t) &= 2\,x(t) \quad &\forall t\\ &\text{Offset} \quad &y(t) &= x(t)\, + \,2 \quad &\forall t\\ &\text{Square signal} \quad &y(t) &= (x(t))^2 \quad &\forall t\\ &\text{Shift} \quad &y(t) &= x(t + 2) \quad &\forall t\\ &\text{Decimate} \quad &y(t) &= x(2t) \quad &\forall t\\ &\text{Square time} \quad &y(t) &= x(t^2) \quad &\forall t \end{align*} $$A system ${H}$ is linear if it satisfies the following two properties:
1) Scaling
$${H} \{\alpha x\} = \alpha {H}\{x\} \quad \forall \, \alpha \in \mathbb{C}$$
2) Additivity
$$ \text{If}\,\, y_1 = {H} \{x_1\} \,\, \text{and}\,\, y_2 = {H} \{ x_2 \} \, \, \text{then } {H} \{x_1 + x_2\} = y_1 + y_2$$
A system ${H}$ processing infinite-length signals is time-invariant (shift-invariant) if a time shift of the input signal creates a corresponding time shift in the output signal
We will only consider Linear Time-Invariant (LTI) systems.
Response to non-zero constant input
$\quad\;\implies$ Same dynamics, but it reaches different steady state
$\quad\;\implies$ Good enough to sketch
$$ \begin{align*} (\dot{y}-\dot{q}) + {1 \over \tau}(y-q) &= 0 \\\\ (\ddot{y}-\ddot{p}) + 2\zeta\omega_n(\dot{y}-\dot{p}) + \omega^2_n (y-p) &=0 \end{align*} $$
$$
\begin{align*}
m\ddot{y} + c\dot{y} + ky &= mg \\
\ddot{y} + {c \over m}\dot{y} + {k \over m}y &= g, \qquad \text{where} \; y(0) = 0, \; \dot{y}(0) = 0
\end{align*}
$$
Start with a step response example
$$ \dot{x} + 5x = 1 \quad \text{for} \quad t \geq 0, \qquad x(0) = 0$$or
$$ \dot{x} + 5x = u(t), \qquad x(0) = 0 \qquad \text{where }\; u(t) = \begin{cases} 1 & t >0\\ 0 & \text{otherwise}\end{cases}$$t = linspace(0,2,100);
x = 1/5*(1-exp(-5*t));
plot(t,x,t,0.2*ones(size(t)),'k--')
ylim([0,0.25])
xlabel('time')
$\quad \;$ and which is also constrained to satisfy the identity
$$\int_{-\infty}^{\infty}\delta(t)dt = 1$$
Momentum and impulse in physics I
Consider an "impulse" which is a sudden increase in momentum $0 \rightarrow mv$ of an object applied at time $0$
To model this,
$\quad\;$ where force $f(t)$ is strongly peaked at time 0
$\quad\;$ The solution is given: (why?)
$$ y(t) = h(t) = e^{-5t},\quad t\geq0$$$\quad\;$ Impulse input can be equivalently changed to zero input with non-zero initial condition (by the impulse and momentum theory)
t = linspace(0,2,100);
h = exp(-5*t);
plot(t,h,t,zeros(size(t)), 'k--'),
ylim([-0.1,1.1])
xlabel('time')
$\quad\;\implies$ impulse response is the derivative of the step response
If this is true, we can compute output response to any general input if an impulse response is given
Example: response to a general input
$$ \dot{y} + 3y = 3x(t)$$The solution is given:
$$ y(t) = h(t)*x(t),\qquad \text{where}\; h(t) = 3e^{-3t}$$% generate a general input
T = 4;
fs = 100;
Ts = 1/fs;
t = 0:Ts:2*T-Ts;
w0 = 2*pi/T;
x = 1/2*square(w0*t);
plot(t,x,'k')
grid on
ylim([-0.6,0.6])
yticks([-0.5,0,0.5])
% convolution (circular, will be discussed later)
h = 3*exp(-3*t);
y = cconv(x,h,length(t))*Ts;
plot(t,x,'k'), hold on
plot(t,y,'b', 'linewidth',2), hold off
grid on
ylim([-0.6,0.6])
yticks([-0.5,0,0.5])
% use lsim
A = -5;
B = 1;
C = 1;
D = 0;
G = ss(A,B,C,D);
w = pi;
t = linspace(0,2*pi,200);
x0 = 0;
x = sin(w*t);
[y,tout] = lsim(G,x,t,x0);
plot(t,x), hold on
plot(tout,y), hold off
grid on
xlabel('t')
axis tight, ylim([-1,1])
leg = legend('input','output');
set(leg, 'fontsize', 12)
% sinusoidal inputs with different w
A = -5;
B = 1;
C = 1;
D = 0;
G = ss(A,B,C,D);
x0 = 0;
t = linspace(0,2*pi,200);
W = [1,5,10,20];
for w = W
x = sin(w*t);
[y,tout] = lsim(G,x,t,x0);
plot(tout,y), hold on
end
hold off
grid on
axis tight, ylim([-0.3,0.3])
xlabel('t')
leg = legend('\omega = 1','\omega = 5','\omega = 10','\omega = 20');
set(leg, 'fontsize', 12)
T = 1;
fs = 100;
t = 0:1/fs:2*T-1/fs;
w0 = 2*pi/T;
x = 1/8*sawtooth(w0*t, 1/2);
% xhat = Fourier series of triangle ware
xhat = zeros(size(t));
for k = -3:2:3
xhat = xhat - 2/(w0^2*k^2)*exp(1j*w0*k*t);
end
plot(t, x, 'k'), hold on
plot(t, xhat, 'b', 'linewidth', 2), hold off
grid on
ylim([-2/8,2/8])
xticks([0,1,2])
yticks([-1/8,0,1/8])
T = 1;
fs = 100;
t = 0:1/fs:2*T-1/fs;
w0 = 2*pi/T;
x = 1/2*square(w0*t);
% xhat = Fourier series of square ware
xhat = zeros(size(t));
for k = -5:2:5
xhat = xhat + 2/(1j*w0*k)*exp(1j*w0*k*t);
end
plot(t, x, 'k'), hold on
plot(t, xhat, 'b', 'linewidth', 2), hold off
grid on
ylim([-5/8,5/8])
xticks([0,1,2])
yticks([-1/2,0,1/2])
T = 1;
fs = 100;
t = 0:1/fs:2*T-1/fs;
w0 = 2*pi/T;
x = 1/2*square(w0*t);
% xhat = Fourier series of square ware
xhat = zeros(size(t));
for k = -19:2:19
xhat = xhat + 2/(1j*w0*k)*exp(1j*w0*k*t);
end
plot(t, x, 'k'), hold on
plot(t, xhat, 'b', 'linewidth', 2), hold off
grid on
ylim([-5/8,5/8])
xticks([0,1,2])
yticks([-1/2,0,1/2])
tau = 1/5;
yhat = zeros(size(t));
for k = -19:2:19
w = w0*k;
A = 1./abs(1j*tau*w + 1);
Ph = -phase(1j*tau*w + 1);
yhat = yhat + A*2/(1j*w0*k)*exp(1j*(w*t + Ph));
end
plot(t, x, 'k'), hold on
plot(t, yhat, 'g', 'linewidth', 2), hold off
grid on
ylim([-5/8,5/8])
xticks([0,1,2])
yticks([-1/2,0,1/2])
leg = legend('square', 'output');
set(leg, 'fontsize', 12, 'location', 'best')
$\implies$ Frequency sweeping is another way to collect LTI system characteristics (same as the impulse response)
Given input $ e^{j\omega t} $
$$ \begin{align*} \dot{y} + 5y &= 5x(t) \\\\ \dot{y} + 5y &= 5e^{j\omega t} \end{align*} $$w = 0.1:0.1:100;
A = 5./abs(1j*w+5);
P = -angle(1j*w+5)*180/pi;
subplot(2,1,1), plot(w, A, 'linewidth', 2)
yticks([0,0.5,1])
ylabel('|H(j\omega)|', 'fontsize', 13)
xlabel('\omega', 'fontsize', 15)
subplot(2,1,2), plot(w, P, 'linewidth', 2)
yticks([-90, -45, 0])
ylabel('\angle H(j\omega)', 'fontsize', 13)
xlabel('\omega', 'fontsize', 15)
% later, we will see that this is kind of a bode plot
The second order ODE
r = 0:0.05:4;
zeta = 0.1:0.2:1;
A = [];
for i = 1:length(zeta)
A(i,:) = 1./sqrt((1-r.^2).^2 + (2*zeta(i)*r).^2);
end
plot(r, A)
xlabel('\gamma')
ylabel('A')
legend('0.1','0.3','0.5','0.7','0.9')
phi = [];
for i = 1:length(zeta)
phi(i,:) = -atan2((2*zeta(i).*r),(1-r.^2));
end
plot(r,phi*180/pi)
xlabel('\gamma')
ylabel('\phi')
legend('0.1','0.3','0.5','0.7','0.9')
%%html
<center><iframe src="https://www.youtube.com/embed/CzJ8EKi11pU?rel=0"
width="560" height="315" frameborder="0" allowfullscreen></iframe></center>
%%html
<center><iframe src="https://www.youtube.com/embed/Mqt_Amkw-0Y?rel=0"
width="560" height="315" frameborder="0" allowfullscreen></iframe></center>
%%html
<center><iframe src="https://www.youtube.com/embed/TYA8C85CdCc?rel=0"
width="560" height="315" frameborder="0" allowfullscreen></iframe></center>
%%javascript
$.getScript('https://kmahelona.github.io/ipython_notebook_goodies/ipython_notebook_toc.js')