Inverse fourier transfer of cos function with time shift
5 次查看(过去 30 天)
显示 更早的评论
Hi there,
I'm creating a fourier transfer of a simple cos function with a time shift of pi, and then trying to invert it. For some reason, the graph of the inversion has a much smaller amplitude although the magnitude and phase look ok. Here's what I've tried:
dt = .001;
t = 0:dt:50;
x1 = cos(4*pi*t);
Wmax = 2*pi*20;
K = 2000;
w = (0:K-1) * Wmax / K;
X1 = x1 * exp(-j * t' * w) * dt;
Y1 = x1 * exp(-j * t' * (w-pi)) * dt;
y1 = 1/(2*pi) * Y1 * exp(j * w' * t) *dt;
mag_X1 = 2 * abs(X1);
phase_X1 = angle(X1);
mag_Y = 2 * abs(Y1);
phase_Y = angle(Y1);
subplot(3,2,1);
plot(t, x1);
xlabel('time');
ylabel('x(t)');
axis([0 5 -1.5 1.5]);
title('time domain');
grid on;
subplot(3,2,2);
plot(t, y1);
xlabel('time');
ylabel('y(t)');
axis([0 5 -1.5 1.5]);
title('time domain');
grid on;
Not sure what's going on? Can somebody please help?
0 个评论
采纳的回答
TED MOSBY
2025-3-21
Hi Matt,
In the inverse transform you are still multiplying by 'dt' instead of the frequency increment 'dω'.
In your code, you have:
y1 = 1/(2*pi) * Y1 * exp(j * w' * t) * dt;
which uses 'dt' as the integration step for frequency. You should replace 'dt' with the frequency‐domain step size:
dw = w(2) - w(1); % Frequency increment
Then in the inverse transform do
y1 = 1/(2*pi) * Y1 * exp(1j * w' * t) * dw;
Also, since the reconstructed signal should be real, calling 'real' in the plot avoids the warning “Imaginary parts of complex X and/or Y arguments ignored.” :
plot(t, real(y1));
Hope this helps!
2 个评论
VBBV
2025-3-22
possibly due to the shift of the integration limits, from -pi to pi to 2*( 0 topi) in the transform.
更多回答(1 个)
Paul
2025-3-22
Hi Matt,
Keep in mind that you are inherently dealing with a windowed cosine, x1(t) = cos(4*pi*t)*w(t), where w(t) = 1 for 0 <= t <= 50 and 0 otherwise.
a) The Fourier transform of that windowed cosine has significant content at negative frequencies, but X1 is only computed for positive frequencies.
b) Is Y1 supposed to be the Fourier transform of y1(t) = x1(t-pi)? If so, I don't believe that's the correct expression for Y1.
c) because of (a), essentially half of Y1 is missing (the portion due to negative frequencies) so y1 won't be correct. In addition, as pointed out by @TED MOSBY, the variable of integration for y1 is w, so the sum should be multiplied by dw.
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
