?? conv_dft.m
字號:
% Name:conv_dft
% Linear convolution Via the DFT
x=input ('Type in the first sequence = ');
h=input ('Type in the second sequenc = ');
% Determine the length of the result of convolution
L=length(x)+length(h)-1;
XE=fft(x,L);
HE=fft(h,L);
% Determine the IDFT of the product
y1=ifft(XE.*HE);
% Plot the sequence generated by DFT-based convolution
% and the error from direct linear convolution
k=0:L-1;
subplot(211),stem(k,y1),xlabel('Time index n'),ylabel('Amplitude')
title('Result of DFT-based linear convolution')
y2=conv(x,h);error=y1-y2;
subplot(212),stem(k,abs(error)),xlabel('Time index n'),ylabel('Amplitude')
title('Magnitude of error sequence')
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -