Frequency domain convolution of system impulse response
조회 수: 12 (최근 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.
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!