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.(adsbygoogle = window.adsbygoogle || []).push({});

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])

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab help required RE Fourier transfor of laser output

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Matlab help required | Date |
---|---|

Matlab MATLab: Not enough inputs for nlinfit | Nov 16, 2017 |

Matlab Help needed to fix a matlab code | Nov 8, 2017 |

New to Matlab, help with vectors | Feb 20, 2016 |

Need help with integral | Dec 23, 2015 |

MATLAB changing axis labes on step()/margin() functions help required please | Oct 27, 2011 |

**Physics Forums - The Fusion of Science and Community**