Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = 64 %Ilość próbek
- n = 0:1:N-1
- % Generowanie 64 próbek
- x1 = sin(2*pi*n/N)
- h = exp(-n/10)
- figure
- subplot(2,1,1)
- stem(n,x1,'-rs')
- xlabel('Numer próbki')
- ylabel('Amplituda')
- title('Pobudzenie - sygnał sinusoidalny')
- set(gca,'xtick')
- axis([-inf 120 -inf inf])
- subplot(2,1,2)
- stem(n,h,'-bs')
- xlabel('Numer próbki')
- ylabel('Amplituda')
- title('Odpowiedź impulsowa')
- set(gca,'xtick')
- axis([-inf 120 -inf inf])
- % 64 punktowa dft sygnalu x1[n]
- dft1 = fft(x1,64)
- % 64 punktowa dft sygnalu h[n]
- dft2 = fft(h,64)
- % Iloczyn widm zespolonych:
- gk = dft1 .* dft2
- % Wyznaczyć IDFT iloczynu G(k):
- idft = ifft(gk)
- % Splot kołowy x1[n] oraz h[n]:
- splkol = cconv(x1, h, N)
- % Porównanie wyników:
- figure
- subplot(2,1,1)
- plot(n,idft,'rs')
- xlabel('n')
- ylabel('Amplituda')
- title('IDFT iloczynu G(k)')
- set(gca,'xtick',[0:2:N],'ytick',[10:2:10])
- grid on
- subplot(2,1,2)
- plot(n,splkol,'bs')
- xlabel('n')
- ylabel('Amplituda')
- title('Splot kołowy x1[n] oraz h[n]')
- set(gca,'xtick',[0:2:N],'ytick',[10:2:10])
- grid on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement