📄 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 + -