Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- close all;
- %wpisanie sygnalu
- n = 0:4;
- x1 = [0 0.5 1 0 0];
- x2 = [0 1 0.5 0 0];
- h = 2.^(n);
- s = x1 + x2;
- X1 = fftshift(fft(x1));
- X2 = fftshift(fft(x2));
- H = fftshift(fft(h));
- %odpowiedz systemu nieprzesunieta
- Y1 = X1 .* H;
- y1 = ifft(Y1);
- Y2 = X2 .* H;
- y2 = ifft(Y2);
- %sygnal x1
- figure(1);
- subplot(6,1,1);
- stem(n,x1);
- xlabel('n');
- ylabel('x1(n)');
- %sygnal x2
- figure(1);
- subplot(6,1,2);
- stem(n,x2);
- xlabel('n');
- ylabel('x2(n)');
- %sygnal h
- subplot(6,1,3);
- stem(n,h);
- xlabel('n');
- ylabel('h(n)');
- %transfortmata X1
- subplot(6,1,4);
- stem(abs(X1));
- xlabel('f');
- ylabel('X1(f)');
- %transfortmata X2
- subplot(6,1,5);
- stem(abs(X2));
- xlabel('f');
- ylabel('X2(f)');
- %transfortmata H
- %suma sygna這w x1 i x2
- subplot(6,1,6);
- stem(s);
- xlabel('n');
- ylabel('x1 + x2');
- %suma sygnalow
- y4 = y1 + y2
- S1 = fftshift(fft(s));
- Y3 = S1 .* H;
- y3 = ifft(Y3);
- figure(2);
- %suma sygna這w x1 i x2
- subplot(5,1,1);
- stem(s);
- xlabel('n');
- ylabel('x1 + x2');
- %wyjscie sumy
- subplot(5,1,2);
- stem(y3);
- xlabel('n');
- ylabel('y3');
- %wyjscie x1
- subplot(5,1,3);
- stem(y1);
- xlabel('n');
- ylabel('y1');
- %wyjscie x1
- subplot(5,1,4);
- stem(y2);
- xlabel('n');
- ylabel('y2');
- %wyjscie y4
- subplot(5,1,5);
- stem(y4);
- xlabel('n');
- ylabel('y4');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement