Borrar filtros
Borrar filtros

frequency domain convolution problem

5 visualizaciones (últimos 30 días)
MENGZE WU
MENGZE WU el 20 de Feb. de 2023
Editada: Matt J el 21 de Feb. de 2023
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)

Respuesta aceptada

Matt J
Matt J el 21 de Feb. de 2023
Editada: Matt J el 21 de Feb. de 2023
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]);

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by