miguelmarve

graficación sencilla serie de fourier y MATLAB

Oct 11th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.54 KB | None | 0 0
  1. clc;
  2. close all;
  3. clear all;
  4. %programa de graficacion de series de fourier
  5. t=0:0.01:1;
  6. T=1;
  7. w0=2*pi;
  8. c=4/pi;
  9. y=c.*sin(w0.*t);
  10. y2=c.*(sin(w0.*t)+((1/3).*(sin(3.*w0.*t))));
  11. y3=c.*(sin(w0.*t)+((1/3).*(sin(3.*w0.*t)))+((1/5).*(sin(5.*w0.*t))));
  12. y4=c.*(sin(w0.*t)+((1/3).*(sin(3.*w0.*t)))+((1/5).*(sin(5.*w0.*t)))+((1/7).*(sin(7.*w0.*t))));
  13. y5=c.*(sin(w0.*t)+((1/3).*(sin(3.*w0.*t)))+((1/5).*(sin(5.*w0.*t)))+((1/7).*(sin(7.*w0.*t)))+((1/9).*(sin(9.*w0.*t))));
  14. y6=c.*(sin(w0.*t)+((1/3).*(sin(3.*w0.*t)))+((1/5).*(sin(5.*w0.*t)))+((1/7).*(sin(7.*w0.*t)))+((1/9).*(sin(9.*w0.*t)))+((1/11).*(sin(11.*w0.*t))));
  15. subplot(3,3,1);
  16. plot(t,y,'k');
  17. title('(4/pi)sin(2pi*t)');
  18. xlabel('t');
  19. ylabel('y');
  20. subplot(3,3,2);
  21. plot(t,y2,'k');
  22. title('(4/pi)(sin(2pi*t)+((1/3)(sin(3(2pi)*t))))');
  23. xlabel('t');
  24. ylabel('y');
  25. subplot(3,3,3);
  26. plot(t,y3,'k');
  27. title('(4/pi)(sin((2pi)*t)+((1/3)(sin(3(2*pi)*t)))+((1/5)(sin(5(2pi)*t))))');
  28. xlabel('t');
  29. ylabel('y');
  30. subplot(3,3,4);
  31. plot(t,y4,'k');
  32. title('(4/pi)(sin((2pi)*t)+((1/3)(sin(3(2pi)*t)))+((1/5)(sin(5(2pi)*t)))+((1/7)(sin(7(2*pi)*t))))');
  33. xlabel('t');
  34. ylabel('y');
  35. subplot(3,3,6);
  36. plot(t,y5,'k');
  37. title('(4/pi)(sin((2*pi)t)+(1/3)(sin(3(2pi)*t))+(1/5)(sin(5(2pi)*t))+((1/7)(sin(7(2pi)*t)))+(1/9)(sin(9(2pi)*t)))');
  38. xlabel('t');
  39. ylabel('y');
  40. subplot(3,3,8);
  41. plot(t,y6,'k');
  42. title('(4/pi)(sin((2pi)t)+((1/3)(sin(3(2pi)*t)))+((1/5)(sin(5(2pi)*t)))+((1/7)(sin(7(2pi)*t)))+((1/9)(sin(9(2pi)*t)))+((1/11)(sin(11(2pi)*t))))');
  43. xlabel('t');
  44. ylabel('y');
  45. %plot(t,y,'r', t,y2,'g', t,y3,'b', t,y4,'y', t,y5,'m', t,y6,'k');
Advertisement
Add Comment
Please, Sign In to add comment