MATLAB: Plot the Intensity and phase of variation of electric field.

fourier transform

Hello everyone.
I have a set of data : "y_spectrum" shows the electric field amplitude and "t_spectrum" shows the time.
Is there anyway to plot the Intensity of this variation and its phase?
Also, after doing Fourier transform , is it possible to obtain its distribution and its phase?
Thank you very much.

Best Answer

The Fourier transform is easy enough to calculate and plot:
t = dlmread('t_spectrum_11480.txt','',1,0);
E = dlmread('y_spectrum_11480.txt','',1,0);
Fs = 1/mean(diff(t)); % Sampling Frequency
[Er,tr] = resample(E,t,Fs); % Resample To Uniform Sampling Interval
L = numel(t); % Length Of Signal
Fn = Fs/2; % Nyquist Frequency
FT_E = fft(E)/L; % Fourier Transform
Fv = linspace(0,1,fix(L/2)+1)*Fn; % Frequency Vector
Iv = 1:numel(Fv); % Index Vector (One-Sided Spectrum)
figure
plot(tr, Er)
grid
title('Time Dommain')
figure
subplot(2,1,1)
plot(Fv, abs(FT_E(Iv))*2)
grid
ylabel('Amplitude Units')
title('Amplitude')
subplot(2,1,2)
plot(Fv, angle(FT_E(Iv)))
grid
xlabel('Frequency (Hz?)')
ylabel('Radians')
title('Phase')
figure
subplot(2,1,1)
plot(Fv, abs(FT_E(Iv))*2)
grid
ylabel('Amplitude Units')
title('Amplitude')
xlim([0 1E+15])
subplot(2,1,2)
plot(Fv, angle(FT_E(Iv)))
grid
xlabel('Frequency (Hz?)')
ylabel('Radians')
title('Phase')
xlim([0 1E+15])
The first plot is the time domain of the resampled signal, the second is the full Fourier spectrum, and the third is the ‘zoomed’ Fourier spectrum.