Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Fs = 20;
- t = 0:10/Fs:150;
- m = sin(t);
- figure(1);
- subplot(3,1,1);
- plot(t,m);
- title('Sine wave');
- k=0;
- for i=1:2:1000
- if(i==1)
- y = sin(i*t);
- else
- y = sin(i*t)/i;
- end
- k = k+y;
- end
- figure(1);
- subplot(3,1,2);
- plot(t,k);
- title('Square wave');
- h = fft(k);
- figure(1);
- subplot(3,1,3);
- plot(t,h);
- title('Fourier Transform');
- figure(2);
- subplot(3,1,1);
- plot(t,m);
- title('Sine wave');
- h=0;
- for i=1:1:1000
- if(i==1)
- y = sin(i*t);
- else
- y = sin(i*t)/i;
- end
- h = h+y;
- end
- figure(2);
- subplot(3,1,2);
- plot(t,h);
- title('Triangular wave');
- l = fft(h);
- figure(2);
- subplot(3,1,3);
- plot(t,l);
- title('Fourier Transform');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement