simulate a single pulse laser in matlab

Here is an example MATLAB code to simulate a single pulse laser using the Optical Toolbox:

main.m
% Define the laser parameters
lambda = 1064e-9;   % wavelength [m]
tau_pulse = 5e-9;   % pulse duration [s]
e_pulse = 1e-6;     % pulse energy [J]
dt = 1e-12;         % time step [s]

% Define the time axis
t = -5*tau_pulse : dt : 5*tau_pulse;

% Define the pulse envelope
envelope = (1 / (tau_pulse * sqrt(2*pi))) * exp(-(t/tau_pulse).^2/2);

% Normalize the pulse energy
envelope = sqrt(e_pulse) * envelope / norm(envelope);

% Create a laser beam object
laser = GaussianBeam(lambda, 'Waist', 0.1, 'RayleighDistance', 1);

% Propagate the laser pulse
pulse = laser.Propagate(t, envelope);

% Visualize the pulse
figure;
plot(t*1e9, abs(pulse).^2);
xlabel('Time [ns]');
ylabel('Power [W]');
title('Single Pulse Laser Simulation');
732 chars
28 lines

This code defines the laser parameters such as the wavelength, pulse duration, pulse energy, and time step. It then creates a time axis and defines the pulse envelope using a Gaussian function. The envelope is normalized to ensure that the pulse energy matches the desired value.

A GaussianBeam object is created to represent the laser beam. The Propagate method is called to simulate the propagation of the pulse through free space. Finally, the pulse is plotted to visualize the results.

gistlibby LogSnag