Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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 = 2000; %Width of figure
  8. height = 1200; %Height of figure
  9. t1 = 0:0.000001:0.02;
  10. t2 = 0:0.000001:0.006;
  11. t3 = 0:0.000001:0.001;
  12. w1 = 480;
  13. w2 = 1725;
  14. w3 = 9950;
  15. u1 = sin(w1*t1);
  16. u2 = sin(w2*t2);
  17. u3 = sin(w3*t3);
  18.  
  19. num = 1;
  20. den = [C*R 1];
  21. sys = tf(num,den)
  22.  
  23.  
  24. figure('pos', [a,b,width,height]);
  25. subplot(3,3,1), step(sys), title('First Order Filter')
  26. subplot(3,3,2), bode(sys), title('Bode plot of First Order Filter')
  27. subplot(3,3,3), bodemag(sys, {500,4000}), title('Bode Magnitude (Cornering Frequency)')
  28. subplot(3,3,4), bodemag(sys, {450,540}), title('Bode Magnitude at 0.9 (-0.915 dB)')
  29. subplot(3,3,5), bodemag(sys, {1599,1870}), title('Bode Magnitude at 0.5 (-6 dB)')
  30. subplot(3,3,6), bodemag(sys, {8942,10450}), title('Bode Magnitude at 0.1 (-20 dB)')
  31. subplot(3,3,7), lsim(sys,u1,t1), title('Response to sin at Magnitude 0.9')
  32. subplot(3,3,8), lsim(sys,u2,t2), title('Response to sin at Magnitude 0.5')
  33. subplot(3,3,9), lsim(sys,u3,t3), title('Response to sin at Magnitude 0.1')
  34.  
  35.  
  36. [mag, phase, wout] = bode(sys);
  37. mag
  38. wout(23:24)
  39. wout(31:32)
  40. wout(42:44)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement