复数FFT然后逆FFT MATLAB [英] Complex FFT then Inverse FFT MATLAB

查看:614
本文介绍了复数FFT然后逆FFT MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在Matlab中使用FFT函数,试图分析行波激光模型的输出.

I am using the FFT function in Matlab in an attempt to analyze the output of a Travelling Wave Laser Model.

模型的形式在时域中(实部,虚部),其思想是将FFT应用于复数输出,以获得频域中的相位和幅度信息:

The of the model is in the time domain in the form (real, imaginary), with the idea being to apply the FFT to the complex output, to obtain phase and amplitude information in the frequency domain:

%load time_domain field data
data = load('fft_data.asc');

% Calc total energy in the time domain
N = size(data,1);
dt = data(2,1) - data (1,1);
field_td = complex (data(:,4), data(:,5));


wavelength = 1550e-9;
df = 1/N/dt;
frequency = (1:N)*df;
dl = wavelength^2/3e8/N/dt;
lambda = -(1:N)*dl +wavelength + N*dl/2;

%Calc FFT
FT = fft(field_td);
FT = fftshift(FT);
counter=1;
phase=angle(FT);
amptry=abs(FT);
unwraptry=unwrap(phase);

在展开之后,将最佳拟合应用于目标区域中的相位,然后从相位本身中减去,以消除目标区域中相位的波长依赖性.

Following the unwrapping, a best fit was applied to the phase in the region of interest, and then subtracted from the phase itself in an attempt to remove wavelength dependence of phase in the region of interest.

for i=1:N % correct phase and produce new IFFT input
    bestfit(i)=1.679*(10^10)*lambda(i)-26160;
    correctedphase(i)=unwraptry(i)-bestfit(i);
    ReverseFFTinput(i)= complex(amptry(i)*cos(correctedphase(i)),amptry(i)*sin(correctedphase(i)));
end

手动执行最佳拟合后,我现在有了如上所示的FFT逆输入.

Having performed the best fit manually, I now have the Inverse FFT input as shown above.

pleasework=ifft(ReverseFFTinput);

现在我可以从中提取时域中的相位和幅度信息:

from which I can now extract the phase and amplitude information in the time domain:

newphasetime=angle(pleasework);
newamplitude=abs(pleasework);

但是,尽管相位的输出与时域中的输入相比有很大差异

However, although the output for the phase is greatly different compared to the input in the time domain

校正后的数据的幅度似乎变化很小(如果有的话!),

the amplitude of the corrected data seems to have varied little (if at all!),

尽管缩放了相位.从物理上讲,这似乎并不正确,因为我的理解是,消除相位的波长依赖性应该压缩"脉冲输入,即缩短脉冲宽度但提高峰值.

despite the scaling of the phase. Physically speaking this does not seem correct, as my understanding is that removing wavelength dependence of phase should 'compress' the pulsed input i.e shorten pulse width but heighten peak.

我的主要问题是我是否未能正确使用逆FFT或正向FFT或两者均未使用,还是像开窗或归一化问题?

My main question is whether I have failed to use the inverse FFT correctly, or the forward FFT or both, or is this something like a windowing or normalization issue?

很抱歉这个冗长的问题!并预先感谢.

Sorry for the long winded question! And thanks in advance.

推荐答案

您实际上看到了两种效果.

You're actually seeing two effects.

首先预期的是.您正在谈论消除相位的波长依赖性".如果您确实做到了–将相位完全归零–您实际上会得到一个稍微压缩的峰. 实际要做的是在相位上添加一个线性函数.这不会压缩任何内容.这是众所周知的变换,等效于在时域中移动峰值.只是傅立叶变换的教科书属性.

First the expected one goes. You're talking about "removing wavelength dependence of phase". If you did exactly that - zeroed out the phase completely - you would actually get a slightly compressed peak. What you actually do is that you add a linear function to the phase. This does not compress anything; it is a well-known transformation that is equivalent to shifting the peaks in time domain. Just a textbook property of the Fourier transform.

然后进行意外的操作.您可以将使用fft获得的光谱与fftshift转换为更好的显示.因此,在使用ifft将其转换回之前,您需要先应用ifftshift.不用了,频谱在频域中有效地移动了.这样一来,您的时域相位就被添加为时间的线性函数,因此相邻点之间的差值(以前接近于零)现在约为pi.

Then goes the unintended one. You convert the spectrum obtained with fft with fftshift for better display. Thus before using ifft to convert it back you need to apply ifftshift first. As you don't, the spectrum is effectively shifted in frequency domain. This results in your time domain phase being added a linear function of time, so the difference between the adjacent points which used to be near zero is now about pi.

这篇关于复数FFT然后逆FFT MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆