MATLAB Matlab help required RE Fourier transfor of laser output

  • Thread starter dazzday
  • Start date
1
0
Hi guys, look time lurker first time poster. Im simulating a simple multimode laser to analyse its output as a function of the number of modes.

Have the code for output P which i think is correct but i now need to do analyse the P spectrum in the Fourier domain.

I know my base should be p = abs(fft(f)) but im struggling to code it right! any help appreciate guys!

% Define laser parameters

Em = 1; %
factor = 2*pi;
c = 3e8; % speed of light
lambda = 1.5500e-006;
L = 1.5;
modes = 80
FSR = c/(2*L); % free spectral range of the cavity
t = -27e-9:1e-12:27e-9; % go from -27 ns to +27 ns in steps of 1 ps.
total = 0;
Upper = (c/lambda)+(modes*FSR); % Upper frequency limit: c/lambda + (modes * FSR)

for f = (c/lambda):FSR:Upper % go from fundamental laser frequency to higher freqs by steps of 1 FSR
phase = randn*factor; % calculate the phase for the mth mode
E = Em*cos(2*pi*f*t+phase); % calculate electric field for mth mode
total = total+E;
end

Power = abs(total).^2;
time = t./(1e-9);

% Plot power spectrum in time domain
PowerPlot = figure;
plot(time,Power/max(Power))
xlabel('time (ns)')
ylabel('y(t)')
title('Power Spectrum in Time Domain')
grid
xlim([-27 27])
 

Related Threads for: Matlab help required RE Fourier transfor of laser output

  • Last Post
Replies
0
Views
6K
  • Last Post
Replies
0
Views
2K
Replies
0
Views
2K
Replies
0
Views
2K
Replies
0
Views
2K
  • Last Post
Replies
0
Views
980
  • Last Post
Replies
0
Views
7K
Top