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 = 1500; %Width of figure
- height = 1200; %Height of figure
- t1 = 0:0.000001:0.02;
- t2 = 0:0.000001:0.012;
- t3 = 0:0.000001:0.01;
- w1 = 780;
- w2 = 1200;
- w3 = 2150;
- u1 = sin(w1*t1);
- u2 = sin(w2*t2);
- u3 = sin(w3*t3);
- num = 1;
- den = [C^3*R^3 2*C^2*R^2 2*C*R 1];
- sys = tf(num,den)
- figure('pos', [a,b,width,height]);
- subplot(3,3,1), step(sys), title('Butterworth Filter')
- subplot(3,3,2), bode(sys), title('Bode plot of Butterworth Filter')
- subplot(3,3,3), bodemag(sys, {30,220}), title('Bode Magnitude (Cornering Frequency)')
- subplot(3,3,4), bodemag(sys, {750.1,900}), title('Bode Magnitude at 0.9 (-0.915 dB)')
- subplot(3,3,5), bodemag(sys, {1169.4,1367.5}), title('Bode Magnitude at 0.5 (-6 dB)')
- subplot(3,3,6), bodemag(sys, {1870.0,2186.7}), 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);
- wout
- mag
- wout(27:28)
- wout(29:30)
- wout(32:33)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement