⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 program_5_4.m

📁 数字信号处理—基于计算机的方法教材上的所有例题源程序
💻 M
字号:
% Program 5_4
% Linear Convolution Via the DFT
%
% Read in the two sequences
x = input('Type in the first sequence = ');
h = input('Type in the second sequence = ');
% Determine the length of the result of convolution
L = length(x)+length(h)-1;
% Compute the DFTs by zero-padding
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
n = 0:L-1;
subplot(2,1,1)
stem(n,y1)
xlabel('Time index n');ylabel('Amplitude');
title('Result of DFT-based linear convolution')
y2 = conv(x,h);
error = y1-y2;
subplot(2,1,2)
stem(n,error)
xlabel('Time index n');ylabel('Amplitude')
title('Error sequence')

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -