Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. clear
  2. clc
  3. R = 10000; %Resistance (Ohms)
  4. C = 0.0000001; %Capacitance (F)
  5. a = 350; %Starting x-coordinate of figure
  6. b = 100; %Starting y-coordinate of figure
  7. width = 1500; %Width of figure
  8. height = 1200; %Height of figure
  9. t1 = 0:0.000001:0.02;
  10. t2 = 0:0.000001:0.012;
  11. t3 = 0:0.000001:0.01;
  12. w1 = 780;
  13. w2 = 1200;
  14. w3 = 2150;
  15. u1 = sin(w1*t1);
  16. u2 = sin(w2*t2);
  17. u3 = sin(w3*t3);
  18.  
  19. num = 1;
  20. den = [C^3*R^3 2*C^2*R^2 2*C*R 1];
  21. sys = tf(num,den)
  22.  
  23. figure('pos', [a,b,width,height]);
  24. subplot(3,3,1), step(sys), title('Butterworth Filter')
  25. subplot(3,3,2), bode(sys), title('Bode plot of Butterworth Filter')
  26. subplot(3,3,3), bodemag(sys, {30,220}), title('Bode Magnitude (Cornering Frequency)')
  27. subplot(3,3,4), bodemag(sys, {750.1,900}), title('Bode Magnitude at 0.9 (-0.915 dB)')
  28. subplot(3,3,5), bodemag(sys, {1169.4,1367.5}), title('Bode Magnitude at 0.5 (-6 dB)')
  29. subplot(3,3,6), bodemag(sys, {1870.0,2186.7}), title('Bode Magnitude at 0.1 (-20 dB)')
  30. subplot(3,3,7), lsim(sys,u1,t1), title('Response to sin at Magnitude 0.9')
  31. subplot(3,3,8), lsim(sys,u2,t2), title('Response to sin at Magnitude 0.5')
  32. subplot(3,3,9), lsim(sys,u3,t3), title('Response to sin at Magnitude 0.1')
  33.  
  34. [mag, phase, wout] = bode(sys);
  35. wout
  36. mag
  37. wout(27:28)
  38. wout(29:30)
  39. wout(32:33)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement