Plot the Intensity and phase of variation of electric field.

15 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Star Strider
Star Strider am 17 Feb. 2020
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.
  10 Kommentare
dang khoa tran
dang khoa tran am 18 Feb. 2020
Ok.
Thank you very much for your time and your suggestion.
Star Strider
Star Strider am 18 Feb. 2020
As always, my pleasure!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by