Plot Autocorrelation for Ultrashort Pulse

8 vues (au cours des 30 derniers jours)
Trang Tran
Trang Tran le 6 Juin 2022
Modifié(e) : Moksh le 8 Sep 2023
Hi, I need to plot the autocorrelation for the gaussian pulse. I am able to plot the pulse but I don't know how to work on the autocorrelation with the integral. I am not really know how to use the integral() to make it works
Here is the autocorrelation function I need
Here is the pulse code
c = 3e+8; % Speed of light
lambda = 2000e-9; % Wavelength
freq = c/lambda; % Actual Frequency of light
T=1/freq; % period
width=100e-15; % Full width at half maximum
tstep=T/10000; % time step
t1=-100*T+tstep:tstep:100*T; % time range -100T to 100T
Egauss=exp(i*(2*pi*freq*t1)).*exp(-2*log(2)*t1.^2/width.^2); % Gaussian intensity pulse
% which different from the Gaussian amplitude modulation by a factor of 2
envelop=exp(-2*log(2)*t1.^2/width.^2); % Gaussian intensity envelope
hold on
plot(t1/(2*pi),real(Egauss),'r','linewidth',0.05)
plot(t1/(2*pi),envelop,'b','linewidth',2)
set(get(gca,'XLabel'),'FontSize',12);
set(get(gca,'YLabel'),'FontSize',12);
set(get(gca,'Yaxis'),'FontSize',12);
set(gca,'FontSize',12,'LineWidth',2);
set(get(gca,'Xaxis'),'FontSize',12);
xlabel('time (fs)')
ylabel('Intensity')
legend('Intensity','Envelope')
Here is my attempt code for the autocorrelation but it doesn't work
c = 3e+8; % Speed of light
lambda = 2000e-9; % Wavelength
freq = c/lambda; % Actual Frequency of light
T=1/freq; % period
width=100e-15; % Full width at half maximum
tstep=T/1000; % time step
t1=-100*T+tstep:tstep:100*T% time range -100T to 100T
t2=-100*T+tstep:tstep:100*T;% time range -100T to 100T
Egauss=exp(i*(2*pi*freq*t1)).*exp(-2*log(2)*t1.^2/width.^2);
Etau=exp(i*(2*pi*freq*(t1-t2))).*exp(-2*log(2)*(t1-t2).^2/width.^2);
fun = @(t1) abs((Egauss+Etau).^2).^2;
q= integral(fun,t1)
plot (t1,q)

Réponses (1)

Moksh
Moksh le 8 Sep 2023
Modifié(e) : Moksh le 8 Sep 2023
Hi Trang,
According to the information provided, I believe that you can generate the signal mentioned in the equation and now you want to plot the autocorrelation for it.
To plot the autocorrelation of the signal generated from the given equation, you can utilize the 'autocorr' function in MATLAB. This function calculates and generates a sample autocorrelation for the provided numerical vector.
Here is an example showing the 'autocorr' function
% Generating a random data for 1000 time samples
t = 0:1000;
x = randn(size(t));
% Plotting the original signal and it's sample autocorrelation
subplot(2, 1, 1)
plot(t, x);
subplot(2, 1, 2)
autocorr(x)
For further understanding of the autocorr' function, please refer to the following document.
Hope this helps!

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by