Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear
- clc
- R = 10000; %Resistance (Ohms)
- C = 0.0000001; %Capacitance (F)
- a = 350; %Starting x-coordinate of figure
- b = 100; %Starting y-coordinate of figure
- width = 2000; %Width of figure
- height = 1200; %Height of figure
- t1 = 0:0.000001:0.02;
- t2 = 0:0.000001:0.006;
- t3 = 0:0.000001:0.001;
- w1 = 480;
- w2 = 1725;
- w3 = 9950;
- u1 = sin(w1*t1);
- u2 = sin(w2*t2);
- u3 = sin(w3*t3);
- num = 1;
- den = [C*R 1];
- sys = tf(num,den)
- figure('pos', [a,b,width,height]);
- subplot(3,3,1), step(sys), title('First Order Filter')
- subplot(3,3,2), bode(sys), title('Bode plot of First Order Filter')
- subplot(3,3,3), bodemag(sys, {500,4000}), title('Bode Magnitude (Cornering Frequency)')
- subplot(3,3,4), bodemag(sys, {450,540}), title('Bode Magnitude at 0.9 (-0.915 dB)')
- subplot(3,3,5), bodemag(sys, {1599,1870}), title('Bode Magnitude at 0.5 (-6 dB)')
- subplot(3,3,6), bodemag(sys, {8942,10450}), title('Bode Magnitude at 0.1 (-20 dB)')
- subplot(3,3,7), lsim(sys,u1,t1), title('Response to sin at Magnitude 0.9')
- subplot(3,3,8), lsim(sys,u2,t2), title('Response to sin at Magnitude 0.5')
- subplot(3,3,9), lsim(sys,u3,t3), title('Response to sin at Magnitude 0.1')
- [mag, phase, wout] = bode(sys);
- mag
- wout(23:24)
- wout(31:32)
- wout(42:44)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement