MATLAB Answers

FFT of coupled oscillator from time domain (picosecond) to frequency domain (wavenumber, cm-1)

26 views (last 30 days)
Kunjanni
Kunjanni on 8 Dec 2020
Edited: Kunjanni on 8 Dec 2020
Hi Guys,
I am trying to do a fft of coupled oscillator from time domian to frequency domain in wavenumber (cm-1). My code to perform this operation as follows,
SP1=load('SP1.mat'); % Data of 1st oscillator
SP2=load('SP2.mat'); % Data of 2nd oscillator
Y1=SP1.SP1(:,2);
Y2=SP2.SP2(:,2);
Fs=1/0.05e-12; %sampling frequency
Ysp1=fft(Y1);% Compute DFT of Y1
msp1=abs(Ysp1); %real values of Ysp1
f = (0:length(Ysp1)-1)*Fs/length(Ysp1); % Frequency vector in Hz
f=f.*(1/29979245800);% Frequency vector in cm-1
Ysp2=fft(Y2);
msp2=abs(Ysp2);
plot(f,msp1, 'linewidth',2,'color','r');
hold on
plot(f,msp2, 'linewidth',2,'color','b');
legend('Sp1','Sp2');
set(gca,'FontSize',20);
set(legend,'Fontsize',10);
xlabel(['Oscillation Wavenumber (cm^{-1})'],'Fontsize',30);
ylabel(['FT Intensity (a.u.)'],'Fontsize',30);
grid on
xlim([0 680]);
-----------------------------------------------------------------------------------
The results from this fit shows that both oscillators oscillators at two frequancies (See the attached result). However, the oscillator considered for this calculation cannot oscillates at two frequencies, at least if there is an second oscillation peak it cannot occur at this high frequency as I got ( see the result). I attached the data here. Please let correct if I am doing something wrong here. Any help would be appreciated.
Thanks in advance :).

  0 Comments

Sign in to comment.

Accepted Answer

David Goodmanson
David Goodmanson on 8 Dec 2020
Edited: David Goodmanson on 8 Dec 2020
HI Kunjanni,
this occurs because the fft contains both positive and negative frequency (wavenumber) components. Zero frequency at the far left on the plot, positive frequency components are on the left half of the plot, and the negative frequency components are on the right half. The plot will make more sense if you use fftshift to put zero frequency (wavenumber) at the center:
Fs=1/0.05e-12; %sampling frequency
fshift = (-N/2:N/2-1)*(Fs/N); % shifted Frequency vector in Hz (assuming N is even)
fshift = fshift.*(1/29979245800); % shifted Frequency vector in cm-1
Ysp1 = fft(Y1); % Compute DFT of Y1
msp1 = abs(Ysp1); %real values of Ysp1 <--incorrect comment, it is abs not real
msp1shift = fftshift(msp1);
plot(fshift,msp1shift, 'linewidth',2,'color','r');
Note that the plot is symmetric around zero frequency. This is always the case when you transform a real function such as Y1.
Positive and negative frequencies occur because for a real oscillation in the time domain, say a cosine wave,
cos(2*pi*f0*t) = (exp(2*pi*i*f0*t) + exp(-2*pi*i*f0*t))/2
and the fft picks up both the f0 and the -f0 part. Most of the time people plot the positive frequency part only, and double it to make up for the factor of 1/2 above. Except the component for f = 0 is not doubled. That's all right for plotting purposes, but once you take abs(Ysp1), if you keep only that and throw away Ysp1 there is no chance anymore to transform back into the time domain.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by