# E71 Assignment 0 Solution

## Problem 1

Parts 1a and 1b (b first)

Using impedances (and voltage divider)

So differential equation is

## Problem 2

Part 2a

Zero at origin, poles at roots of , or s=-1+/-3.87j

Part 2b

sys2b=tf([0 2 0],[1 2 16])
[z,p,k]=zpkdata(sys2b,'v')
pzmap(sys2b);  axis([-3 1 -10 10]);
damp(sys2b)

Transfer function:
2 s
--------------
s^2 + 2 s + 16

z =
0

p =
-1.0000 + 3.8730i
-1.0000 - 3.8730i

k =
2

-1.00e+000 + 3.87e+000i     2.50e-001      4.00e+000
-1.00e+000 - 3.87e+000i     2.50e-001      4.00e+000    

Part 2c

sys2c=tf([0 0.2 0],[1 0.2 16])
[z,p,k]=zpkdata(sys2c,'v')
pzmap(sys2c);  axis([-3 1 -10 10]);
damp(sys2c)

Transfer function:
0.2 s
----------------
s^2 + 0.2 s + 16

z =
0

p =
-0.1000 + 3.9987i
-0.1000 - 3.9987i

k =

0.2000

-1.00e-001 + 4.00e+000i     2.50e-002      4.00e+000
-1.00e-001 - 4.00e+000i     2.50e-002      4.00e+000                                                            

Part 2d

sys2d=tf([0 4 0],[1 4 64])
[z,p,k]=zpkdata(sys2d,'v')
pzmap(sys2d);  axis([-3 1 -10 10]);
damp(sys2d)

Transfer function:
4 s
--------------
s^2 + 4 s + 64

z =
0

p =
-2.0000 + 7.7460i
-2.0000 - 7.7460i

k =
4

-2.00e+000 + 7.75e+000i     2.50e-001      8.00e+000
-2.00e+000 - 7.75e+000i     2.50e-001      8.00e+000                                                            

Part 2e

2 finite poles, 1 finite zero, 1 zero at infinity.

Part 2f

As increases, poles move away from the origin, as decreases, the location of the poles are more nearly vertical.

## Problem 3

Part 3ai

syms s
symTF = 2*s/(s^2+2*s+16)     %Symbolic transfer function

symTF =
(2*s)/(s^2 + 2*s + 16)

Step Response (Laplace)

symStepResponse = symTF/s  %Step response TF times 1/s (unit step)

symStepResponse =
2/(s^2 + 2*s + 16)

Step Response (Time) -- or could use table

symStepResponseTime=simple(ilaplace(symStepResponse));
pretty(symStepResponseTime)
      1/2       1/2
2 15    sin(15    t)
--------------------
15 exp(t)

Part 3aii

t=linspace(0,15,500);
y=eval(vectorize(symStepResponseTime));
plot(t,y)
title('Step Response, part 3aii');


Part 3aiii

[symN,symD]=numden(symTF);
sys3a=tf(sym2poly(symN),sym2poly(symD))
step(sys3a,15);
title('Step Response, part 3aiii, \zeta=0.25, \omega_0=4');
%
% This plot should be the same as the previous one.

Transfer function:
2 s
--------------
s^2 + 2 s + 16


Part 3b

This is just half of the anser to problem 3ai, so

Part 3c

This is just the sum of parts a and b

## Problem 4

Part 4a

sys4a=tf([0 2*0.025*4 0],[1 2*0.025*4 16]);
step(sys4a,15);
title('Step Response, part 4a, \zeta=0.025, \omega_0=4');


Part 4b

sys4b=tf([0 2*0.25*8 0],[1 2*0.25*8 64]);
step(sys4b,15);
title('Step Response, part 4a, \zeta=0.25, \omega_0=8');


Part 4c

System speeds up as increases. Damping increases as increases.

## Problem 5

Part 5a

bode(sys2b);
title('Bode Response, part 5a, \zeta=0.25, \omega_0=4');

pzmap(sys2b);  axis([-3 1 -10 10]);


Part 5b

w=4;


Draw magnitude plot with magnitude shown

[mag,phs,omega]=bode(sys2b);
semilogx(omega,20*log10(mag(:)));
title('Bode plot (Mag)'); ylabel('Mag (dB)'); xlabel('\omega');
xa = [10 w];	ya = [-25 0];
[xaf,yaf] = ds2nfu(xa,ya);
annotation('textarrow',xaf,yaf,'String','At \omega=4, mag=0dB=1');


Draw phase plot with phase shown

clf
semilogx(omega,phs(:));
title('Bode plot (Phase)'); ylabel('Deg (^o)'); xlabel('\omega');
xa = [10 w];	ya = [-40 0];
[xaf,yaf] = ds2nfu(xa,ya);
annotation('textarrow',xaf,yaf,'String','At \omega=4, phs=0^o');


Exact values

H=evalfr(sys2b,1j*w);
m=abs(H);  p=angle(H);
fprintf('Magnitude of Bode plot at %g radian per second is %g=%gdB.\n',...
w,m,20*log10(m));
fprintf('Phase is %g degrees.\n',p*180/pi);
fprintf('Output = %g sin(%gt + %g degrees)\n',2*m,w,45+p*180/pi);

Magnitude of Bode plot at 4 radian per second is 1=0dB.
Phase is 0 degrees.
Output = 2 sin(4t + 45 degrees)


This is the resonant frequency, so output is maximal.

Part 5c

w=1;


Draw magnitude plot with magnitude shown

clf
semilogx(omega,20*log10(mag(:)));
title('Bode plot (Mag)'); ylabel('Mag (dB)'); xlabel('\omega');
xa = [3 w];	ya = [-30 -17.6];
[xaf,yaf] = ds2nfu(xa,ya);
annotation('textarrow',xaf,yaf,'String','At \omega=1, mag=-17.6dB=0.13');


Draw phase plot with phase shown

clf
semilogx(omega,phs(:));
title('Bode plot (Phase)'); ylabel('Deg (^o)'); xlabel('\omega');
xa = [0.4 w];	ya = [-40 82.4];
[xaf,yaf] = ds2nfu(xa,ya);
annotation('textarrow',xaf,yaf,'String','At \omega=1, phs=82.4^o');


Exact values

H=evalfr(sys2b,1j*w);
m=abs(H);  p=angle(H);
fprintf('Magnitude of Bode plot at %g radian per second is %g=%gdB.\n',...
w,m,20*log10(m));
fprintf('Phase is %g degrees.\n',p*180/pi);
fprintf('Output = %g sin(%gt + %g degrees)\n',2*m,w,45+p*180/pi);

Magnitude of Bode plot at 1 radian per second is 0.132164=-17.5778dB.
Phase is 82.4054 degrees.
Output = 0.264327 sin(1t + 127.405 degrees)


Note output is smaller than previous case (w=4).

Part 5d

clf
bode(sys4a)
title('Bode Response, part 5d, \zeta=0.025, \omega_0=4');
pzmap(sys4a);  axis([-3 1 -10 10]);


Part 5e

bode(sys4b)
title('Bode Response, part 5e, \zeta=0.25, \omega_0=8');
pzmap(sys4b);  axis([-3 1 -10 10]);


Part 5f

As decreases, poles are nearer the axis, so peak is sharper. As decreases, poles are nearer real axis, so peak is at lower frequency.

Part 5g

Filter is bandpass

Part 5h

Because system has zeros at origin and at infinity, gain goes to zero at low and high frequencies (and peaks in between, near ).

## Problem 6

Part 6a

sys6=tf([0 0 16],[1 2 16])
pzmap(sys6);  axis([-3 1 -10 10]);


Transfer function:
16
--------------
s^2 + 2 s + 16



Part 6b

The system has two finite poles and two zeros as s goes to infinity

Part 6c

bode(sys6);


Part 6d

The system is lowpass

Part 6e

Since the system has zeros at infinity, and nowhere else, the output only goes to zero at high frequencies (and low ones are passed)

Part 6f

w=4;
H=evalfr(sys6,1j*w);
m=abs(H);  p=angle(H);
fprintf('Magnitude of Bode plot at %g radian per second is %g=%gdB.\n',...
w,m,20*log10(m));
fprintf('Phase is %g degrees.\n',p*180/pi);
fprintf('Output = %g sin(%gt + %g degrees)\n',2*m,w,45+p*180/pi);

Magnitude of Bode plot at 4 radian per second is 2=6.0206dB.
Phase is -90 degrees.
Output = 4 sin(4t + -45 degrees)


Part 6g

w=1;
H=evalfr(sys6,1j*w);
m=abs(H);  p=angle(H);
fprintf('Magnitude of Bode plot at %g radian per second is %g=%gdB.\n',...
w,m,20*log10(m));
fprintf('Phase is %g degrees.\n',p*180/pi);
fprintf('Output = %g sin(%gt + %g degrees)\n',2*m,w,45+p*180/pi);

Magnitude of Bode plot at 1 radian per second is 1.05731=0.484045dB.
Phase is -7.59464 degrees.
Output = 2.11462 sin(1t + 37.4054 degrees)


Note that low frequency signal is passed.

## Problem 7

Part 7a

sys7=tf([1 0 0],[1 2 16])
pzmap(sys7);  axis([-3 1 -10 10]);
xa = [-1 0];	ya = [1 0];
[xaf,yaf] = ds2nfu(xa,ya);
annotation('textarrow',xaf,yaf,'String','Double Zero');


Transfer function:
s^2
--------------
s^2 + 2 s + 16



Part 7b

The system has two finite poles and two finite zeros at the origin

Part 7c

clf;
bode(sys7);


Part 7d

System is highpass

Part 7e

Since the system has zeros at the origin, and nowhere else, the output only goes to zero at low frequencies (and high ones are passed)

Part 7f

w=4;
H=evalfr(sys7,1j*w);
m=abs(H);  p=angle(H);
fprintf('Magnitude of Bode plot at %g radian per second is %g=%gdB.\n',...
w,m,20*log10(m));
fprintf('Phase is %g degrees.\n',p*180/pi);
fprintf('Output = %g sin(%gt + %g degrees)\n',2*m,w,45+p*180/pi);

Magnitude of Bode plot at 4 radian per second is 2=6.0206dB.
Phase is 90 degrees.
Output = 4 sin(4t + 135 degrees)


Part 7g

w=1;
H=evalfr(sys7,1j*w);
m=abs(H);  p=angle(H);
fprintf('Magnitude of Bode plot at %g radian per second is %g=%gdB.\n',...
w,m,20*log10(m));
fprintf('Phase is %g degrees.\n',p*180/pi);
fprintf('Output = %g sin(%gt + %g degrees)\n',2*m,w,45+p*180/pi);

Magnitude of Bode plot at 1 radian per second is 0.0660819=-23.5984dB.
Phase is 172.405 degrees.
Output = 0.132164 sin(1t + 217.405 degrees)


Note that low frequency signal is attenuated.