frequency domain convolution problem
조회 수: 5 (최근 30일)
이전 댓글 표시
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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1301480/image.png)
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)
댓글 수: 0
채택된 답변
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
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!