drawing gaussian wave in matlab
5 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
How can I plot a 2D profile of a red laser beam (λ = 600 nm) with a beam-waist of 0.5 mm that is in z-y or z-x plane, where z (0<z<20 m) ) is the propagation direction?
3 commentaires
Réponses (1)
Image Analyst
le 7 Avr 2023
Try this:
% Optional initialization steps
clc; % Clear the command window.
close all; % Close all figures (except those of imtool.)
clear; % Erase all existing variables. Or clearvars if you want.
workspace; % Make sure the workspace panel is showing.
format long g;
format compact;
fontSize = 18;
% Define how many elements you want along your z axis,
% which runs from 0 to 20.
numElements = 2000;
z = linspace(0, 20, numElements);
% Define z0 as something. (It's not z(0) which has a value of zero.
z0 = 5;
% Define w0 as something.
w0 = 3;
w = w0 * sqrt(1 + (z / z0) .^ 2);
% Plot w vs z
plot(z, w, 'b-', 'LineWidth', 3);
grid on;
title('Beam Waist Diameter as a Function of z', 'FontSize', fontSize);
xlabel('z [meters]', 'FontSize', fontSize);
ylabel('Waist Diameter [meters?]', 'FontSize', fontSize);
g = gcf;
g.Name = 'Demo by Image Analyst for Yasemin';
g.NumberTitle = 'off';
g.WindowState = 'maximized'
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1348714/image.png)
2 commentaires
Image Analyst
le 7 Avr 2023
You're welcome.
If this Answer solves your original question, then could you please click the "Accept this answer" link to award the answerer with "reputation points" for their efforts in helping you? They'd appreciate it. Thanks in advance. 🙂 Note: you can only accept one answer (so pick the best one) but you can click the "Vote" icon for as many Answers as you want. Voting for an answer will also award reputation points.
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!