Advertisement
szymcio93

1c

Oct 6th, 2015
39
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. close all;
  2. clear all;
  3.  
  4. A=230;
  5. fs=100;
  6. t=1;
  7.  
  8. counter=1;
  9.  
  10. number=1;
  11.  
  12. for f=0:5:300
  13. w=2*pi*f;
  14.  
  15. for i=0:1/fs:t
  16. x(counter)=i;
  17. y(counter)=sin(w*i);
  18. %y(licznik)=cos(w*i);
  19. counter=counter+1;
  20. end
  21.  
  22.  
  23. Title=['petla nr ' int2str(number) ', ' 'f = ' int2str(f)];
  24. hold on
  25. plot(x,A*y)
  26. xlabel('second')
  27. ylabel('Volt')
  28. title(Title);
  29. counter=1;
  30. number=number+1;
  31.  
  32. pause(1);
  33. end
  34.  
  35.  
  36.  
  37. f1=5;
  38. f2=105;
  39. f3=205;
  40. counter=1;
  41. for i=0:1/fs:t
  42. x1(counter)=i;
  43. y1(counter)=sin(2*pi*f1*i);
  44. %y1(counter)=cos(2*pi*f1*i);
  45.  
  46. x2(counter)=i;
  47. y2(counter)=sin(2*pi*f2*i);
  48. %y2(counter)=cos(2*pi*f2*i);
  49.  
  50. x3(counter)=i;
  51. y3(counter)=sin(2*pi*f3*i);
  52. %y3(counter)=cos(2*pi*f3*i);
  53.  
  54. counter=counter+1;
  55. end
  56.  
  57. figure
  58. hold on
  59. plot(x1,A*y1,'b-')
  60. xlabel('second')
  61. ylabel('Volt')
  62. plot(x2,A*y2,'r-o')
  63. plot(x3,A*y3,'k-x')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement