Kamilgüler HW2

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

APPENDIX

Question 4
Case A
t = 0:0.001:4;
x = 0.001*cos(141.421*t);
plot(t,x)

Case B
t = 0:0.005:4;
x = exp(-t).*((7.07)*(10^-
6).*sin(141.418.*t)+0.001*cos(141.418.*t));
plot(t,x)

Case C
t = 0:0.005:4;
x = exp(t).*((7.07)*(10^-
6).*sin(141.418.*t)+0.001*cos(141.418.*t));
plot(t,x)

Question 5
%% Case A
t = 0:0.01:6;
P = 100;
f = 10;
c = 0.02;
wn = 10;
wn_rad = 2*pi*10;
m = 100;
%% Response
u = 100*sin(20*pi*t)
Sys = tf(1,[1 2*c*wn_rad wn_rad^2]);
[y,t,x] =lsim(Sys,u,t);

%% Case B
t = 0:0.01:2;
P = 100;
f = 10;
F = P * sin (f*t);
c = 0.02;
wn = 10;
wn_rad = 2*pi*10;
m = 100;
%% Response
u =F;
Sys = tf(1,[1 2*c*wn_rad wn_rad^2]);
[y,t,x] =lsim(Sys,u,t);
t = 0:0.01:2;
P = 100;
f = 9;
F = P * sin (f*t);
c = 0.01;
wn = 10;
m = 100;
%% Response
u = 100*sin(18*pi*t);
Sys = tf(1,[1 2*c*wn_rad wn_rad^2]);
[y1,t,x] =lsim(Sys,u,t);
figure;
plot(t,y,'b', t,y1,'c');
grid on;
legend ('Case a','Case b')

You might also like