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

📄 program_03_05.m

📁 matlab写的数字信号处理源代码,简化你的信号处理的工作。
💻 M
字号:
% Program 3_5
% Linear Convolution Via the DFT
%
% Read in the two sequences

colordef black;
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
k = 0:1:L-1;
subplot(2,1,1)
stem(k,y1,'g')
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(k,abs(error),'g')
xlabel('Time index n');ylabel('Amplitude')
title('Magnitude of error sequence')

⌨️ 快捷键说明

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