필터 지우기
필터 지우기

frequency domain convolution problem

조회 수: 12 (최근 30일)
MENGZE WU
MENGZE WU 2023년 2월 20일
편집: Matt J 2023년 2월 21일
I have two rectangular signals in time domain, both of them have amptitude of 1, but different width. The signal 1 have width of 300 and siganl 2 have width of 600. If they were mutiply in time domain, the outcome will be only signal 1, so the output spectrum should be exactly the same as signal 1.
Since the multiplication of the time domain should be equal to convolution of frequency domain, so I convolve their spectrum. The output should be the same as signal 1 spectrum, but instead I get rubbish.
What have I done wrong? Thanks!
clear all
fs = 1;
Tm = 150/fs;
T = Tm/2;
f = linspace(1e-4,0.5,1e6);
figure
Signal_1 = Tm*sin(2*pi*T.*f./fs)./(2*pi*T.*f./fs); % Signal 1 spectrum, sinc function
plot(f, abs(Signal_1))
Tm2 = 300/fs;
T2 = Tm/2;
Signal_2 = Tm2*sin(2*pi*T2.*f./fs)./(2*pi*T2.*f./fs); % Signal 2 spectrum, also sinc function
plot(f, abs(Signal_2))
Output = conv(Signal_1, Signal_2, "same"); % Convolution of Signal 1 and Signal 2 in frequency domain
plot(f, Output)

채택된 답변

Matt J
Matt J 2023년 2월 21일
편집: Matt J 2023년 2월 21일
You have only generated half a sinc, rather than a full sinc from -infinity to +infinity.
Keep in mind as well that there will be discretization effects from truncating the sincs to a a finite window and from discrete sampling.
fs = 1;
Tm = 150/fs;
T = Tm/2;
f = linspace(-0.5,0.5,1e4);
Signal_1 = Tm*sin(2*pi*T.*f./fs)./(2*pi*T.*f./fs); % Signal 1 spectrum, sinc function
Tm2 = 300/fs;
T2 = Tm/2;
Signal_2 = Tm2*sin(2*pi*T2.*f./fs)./(2*pi*T2.*f./fs); % Signal 2 spectrum, also sinc function
Output = conv(Signal_1, Signal_2, "same")*(f(2)-f(1)); % Convolution of Signal 1 and Signal 2 in frequency domain
plot(f, Signal_2,'-k',f(1:5:end), Output(1:5:end),'x');legend('Signal 2','Output')
xlim([-0.05,+0.05]);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by