4

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

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

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

blue=output of phase in time domain after inverse FFT back

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

enter image description here enter image description here

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.

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.

KRS-fun
  • 696
  • 3
  • 9
  • 20
  • I recommend you also plot the amplitude and phase in frequency domain and how they change after your operation (ReverseFFTInput). – ypnos Aug 12 '12 at 20:22
  • ReverseFFTInput is the complex input for the inverse fourier transform after the phase modification has been performed. It is already in the frequency domain, and the 'ifft()' function shows the components of ReverseFFTinput in the time domain – KRS-fun Aug 13 '12 at 12:07
  • What I wanted to express is that you only plot in the time domain. You should also plot in the frequency domain, after fft() and before ifft() to see what change you impose on the signal in the frequency domain. Like what they do here for a 2D signal: http://www.cs.unm.edu/~brayer/vision/fourier.html – ypnos Aug 14 '12 at 09:44
  • 1
    Can you share a link to the "fft_data.asc" file so that your results can be reproduced? – Eitan T Aug 19 '12 at 07:07
  • https://docs.google.com/open?id=0B8N_x95j5pgaall2Vk1QMTlZTE0 @EitanT sure I can here is the link. Thanks for your time! – KRS-fun Aug 20 '12 at 00:45

1 Answers1

4

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.

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.

Tanriol
  • 1,184
  • 1
  • 7
  • 12
  • Does this mean that fitting a best fit to the unwrapped phase and subtracting this from the actual phase in not a valid method to attempt to compress the pulses? – KRS-fun Aug 25 '12 at 14:40
  • I was under the impression that turning the wavelength dependence on the phase into a constant ( or as close as possible) within the bounds of the pulses in the spectral range would reduce chirp and thus compress the peak? – KRS-fun Aug 26 '12 at 16:17
  • 1
    In general, yes, it will. However, you're fitting a linear function, but a linear summand does not change the peak shape. If you need to compress it you need to use nonlinear functions for approximation. Linear ones are of no use for this task. – Tanriol Aug 26 '12 at 19:28
  • What if the phase within the chirp is linear with wavelength? – KRS-fun Aug 26 '12 at 20:15
  • 1
    If the phase is linear w.r.t. wavelength, your peak is already in the most compressed state possible. – Tanriol Aug 27 '12 at 15:29