Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = 16;
- n = 0:N-1;
- close all;
- 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);
- figure;
- hold on;
- plot(y1,'red');
- plot(y2,'blue');
- plot(y3,'black');
- 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')
- figure;
- subplot(2,2,1);
- x1=2*fft(y1)/N;
- stem(abs(x1));
- axis([0 16 0 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Magnituda');
- title('y1[n]=cos(2*pi*n/N+pi/4)');
- subplot(2,2,2);
- x2=2*fft(y2)/N;
- stem(abs(x2));
- axis([0 16 0 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Magnituda');
- title('y2[n]=0.5*cos(4*pi*n/N)');
- subplot(2,2,3);
- x3=2*fft(y3)/N;
- stem(abs(x3));
- axis([0 16 0 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Magnituda');
- title('y3[n]=0.5*cos(4*pi*n/N)');
- y4=y1+y2+y3;
- subplot(2,2,4);
- x4=2*fft(y4)/N;
- stem(abs(x4));
- axis([0 16 0 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Magnituda');
- title('y1+y2+y3');
- figure;
- z1=angle(x1)/pi;
- subplot(3,2,1);
- stem(z1);
- axis([0 16 -1 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Faza[pi x rad]');
- title('y1[n]=cos(2*pi*n/N+pi/4)');
- z2=angle(x2)/pi;
- subplot(3,2,2);
- stem(z2);
- axis([0 16 -1 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Faza[pi x rad]');
- title('y2[n]=0.5*cos(4*pi*n/N)');
- z3=angle(x3)/pi;
- subplot(3,2,3);
- stem(z3);
- axis([0 16 -1 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Faza[pi x rad]');
- title('y3[n]=0.5*cos(4*pi*n/N)');
- z4=angle(x4)/pi;
- subplot(3,2,4);
- stem(z4);
- axis([0 16 -1 1]);
- xlabel('Numer pasma częstotliwościowego');
- ylabel('Faza[pi x rad]');
- title('y1+y2+y3');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement