Simulation (1)
Simulation (1)
--> s = poly(0, 's'); // Define the transfer function G(s) = 1 / (s^2 + 2*δ*s + 36)
P = [rational] of s
1
-------------
36 +0.2s +s^2
P = [rational] of s
1
-------------
36 +0.2s +s^2
--> s = poly(0, 's'); // Define the transfer function G(s) = 1 / (s^2 + 2*δ*s + 36)
P = [rational] of s
1
-------------
36 +0.2s +s^2
P = [rational] of s
1
-------------
36 +0.2s +s^2
--> y = csim(u, t, P); // for simulating the time response of a system based on a defined input
signal
--> ylabel("Amplitude");
Question 2
s = poly(0, 's');
--> zeta2 = 6;
--> t = 0:0.1:20;
--> u = ones(t);
--> ylabel('Output');
Question 6
f=logspace(-5,2,1000);
w=2*%pi*f; // convert to rad/s
Pmag=zeros(1,1000);
Pph=zeros(1,1000);
for k=1:1000, // compute P(jw) at each frequency point
P=1/(-10*w(k)^2+0.1*%i*w(k));
[Pmag(k),Pph(k)]=polar(P);
end
Pmag = 20*log10(Pmag); // convert Pmag to dB
Pph = (180/%pi)*Pph; // convert Pph to degree
figure(2)
subplot(211),plot2d("ln",f,Pmag); // magnitude plot
xlabel("Frequency (Hz)");
ylabel("Magnitude");
subplot(212),plot2d("ln",f,Pph); // phase plot
xlabel("Frequency (Hz)");
ylabel("Phase (degree)");