Inverse fourier transfer of cos function with time shift
조회 수: 6 (최근 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!
