Frequency domain convolution of system impulse response
2 次查看(过去 30 天)
显示 更早的评论
I have a system impulse response H(s) = 1/(1+10^-6*s) and a rectangular pulse. I have the spectrum of both of them. I want to see the spectrum of this system multiply by the rectangular pulse in time domain, so I convolve them in frequency domain. But I see strange behavior in the spectrum that has a lot of ringing, and I'm not sure if I did this right.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1301635/image.png)
clear all
fs = 1;
f = linspace(-1,1,1e5);
s = j*2*pi*f/fs;
Hs = 1./(1+10^-6.*s); % System impluse response
plot(f, Hs)
Tm = 150/fs;
T = Tm/2;
Sinc = Tm*sin(2*pi*T.*f./fs)./(2*pi*T.*f./fs); % Rectangular wave spectrum
plot(f, Sinc)
Xrec = Sinc.*exp(-j*T*pi.*f./fs); % Rectangular wave spectrum shifted T in time domain
plot(f, Xrec)
Output = conv(Xrec, Hs, 'same').*(f(2)-f(1)); % Convolution of Hs and shifted rectangular in frequency domain
plot(f, Output)
0 个评论
回答(1 个)
Adam Drake
2023-2-21
I'm not familar with the content of your question, but I hope the graphing improvements may help you diagnose. 'j' was undefined and I'm imagining it's some kind of damping coefficient. You might try different values to get optimal damping.
clear all
fs = 1;
f = linspace(-1,1,1e5);
j = 1;
s = j * 2 * pi * f/fs;
% System impluse response
Hs = 1 ./ (1 + 10^-6 .* s);
figure
plot(f, Hs)
title('System Impulse Response')
xlabel('f')
ylabel('H(s)')
% Rectangular wave spectrum
Tm = 150 / fs;
T = Tm / 2;
Sinc = Tm * sin(2 * pi * T .* f./fs) ./ (2 * pi * T .*f ./fs);
figure
plot(f, Sinc)
title('Rectangular Wave Spectrum')
xlabel('f')
ylabel('sinC')
% Rectangular wave spectrum shifted T in time domain
Xrec = Sinc .* exp(-j * T * pi .* f./fs);
figure
plot(f, Xrec)
title('Rectangular Wave Spectrum')
subtitle('Shifted T in Time Domain')
xlabel('f')
ylabel('Xrec')
% Convolution of Hs and shifted rectangular in frequency domain
Output = conv(Xrec, Hs, 'same') .* (f(2) - f(1));
figure
plot(f, Output)
title('Convolution of Hs and Shifted Rectangular in Frequency Domain')
xlabel('f')
ylabel('Output')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Spectral Measurements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!