Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = 32;
- n = 0 : 1 : N - 1;
- y1 = cos((2 * pi * n / N) + pi / 4);
- y2 = 0.5 * cos((4 * pi * n) / N);
- y3 = 0.25 * cos((8 * pi * n / N) + pi / 2);
- y4 = y1 + y2 + y3;
- figure
- plot(n, y1, n, y2, n, y3);
- xlabel('Numer próbki');
- ylabel('Wartość');
- legend('y1[n] = cos((2 * pi * n / N) + pi / 4)', 'y2[n] = 0.5 * cos((4 * pi * n) / N)', 'y3[n] = 0.25 * cos((8 * pi * n / N) + pi / 2)');
- y1fourier = 2 * fft(y1) / length(y1);
- y2fourier = 2 * fft(y2) / length(y2);
- y3fourier = 2 * fft(y3) / length(y3);
- y4fourier = 2 * fft(y4) / length(y4);
- figure
- subplot(4,2,1)
- stem(abs(y1fourier));
- subplot(4,2,2)
- stem(abs(y2fourier));
- subplot(4,2,3)
- stem(abs(y3fourier));
- subplot(4,2,4)
- stem(abs(y4fourier));
- N = 32 * 8;
- n = 0 : 1 : N - 1;
- y1 = cos((2 * pi * n / N) + pi / 4);
- y2 = 0.5 * cos((4 * pi * n) / N);
- y3 = 0.25 * cos((8 * pi * n / N) + pi / 2);
- y4 = y1 + y2 + y3;
- subplot(4,2,5)
- stem(angle(y1fourier));
- subplot(4,2,6)
- stem(angle(y2fourier));
- subplot(4,2,7)
- stem(angle(y3fourier));
- subplot(4,2,8)
- stem(angle(y4fourier));
- axis([0 20 -2 2]);
Advertisement
Add Comment
Please, Sign In to add comment