Frequency domain convolution of system impulse response
11 views (last 30 days)
Show older comments
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.
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 Comments
Answers (1)
Adam Drake
on 21 Feb 2023
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')
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!