## LaTeX forum ⇒ Graphics, Figures & Tables ⇒ Transverse Intensity Profile of a Laser Beam

Information and discussion about graphics, figures & tables in LaTeX documents.
Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm

### Transverse Intensity Profile of a Laser Beam

Hi everybody,

I'm curious, if there is a way to realize a laser beam profile and its Gauss fit in the manner sketched in the uploaded files.

Attachments
image3.png (16.86 KiB) Viewed 3763 times
traverse-int.JPG (2.79 KiB) Viewed 3763 times

Tags:

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
The simplest solution I can think of is one with TikZ/PGF. It could look like this. The output is attached.
\documentclass[11pt]{standalone}\usepackage[T1]{fontenc}\usepackage{tikz} \begin{document}   \begin{tikzpicture}[     scale=3,     samples=50,     declare function={mu=2;},     declare function={sigma=0.3;},     declare function={normal(\m,\s)=1/(2*\s*sqrt(pi))*exp(-(\x-\m)^2/(2*\s^2));}   ]     \path[inner color=red] (1,1) rectangle (3,3);     \draw plot[domain=1:3] (\x,{normal(mu,sigma)});     \draw[rotate=90]  plot[domain=1:3] (\x,{-normal(mu,sigma)});   \end{tikzpicture}\end{document}

There is probably a more complicated solution (3D, color gradients, …). But this should be a good starting point.

Thorsten
Attachments
ytmp.png (8.22 KiB) Viewed 3748 times
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm
@localghost
this looks really fantastic, thanks.

i have missed to say that i have the gaussian beam image done with a camera. i wanted to fit or put the bell-curve alongsides the image taken with the camera.

regards

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
thinkpadT wrote:[…] i have missed to say that i have the gaussian beam image done with a camera. i wanted to fit or put the bell-curve alongsides the image taken with the camera. […]

If it's not a secret, you could attach that picture (perhaps with reduced resolution) to your next post. And perhaps you could describe how this fit should look as well as where and how it should be placed.
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm
@localghost

hi,

the picture is indeed not a secret, and it is attached in my first post (the black and white picture "traverse-int.JPG") and the fits i wanted is drawn with MS paint and they are supposed to be Gaussian and they should be placed in positions showed in that picture.

Now i have the picture and the fit done separately. I wanted to placed them like in the picture. That would be one way i would like to have them

But if there was a way to use Latex, TikZ or pgf plot and do that in one code would be also a great thing.

regards

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
thinkpadT wrote:[…] the picture is indeed not a secret, and it is attached in my first post (the black and white picture "traverse-int.JPG") and the fits i wanted is drawn with MS paint and they are supposed to be Gaussian and they should be placed in positions showed in that picture. […]

That was not clear to me from your first post. The solution is still with TikZ/PGF. I have cut the picture to the relevant content and attached it to this post a well as the resulting output from the below code.
\documentclass[11pt]{article}\usepackage[T1]{fontenc}\usepackage{tikz}  \pgfdeclareimage[height=4cm]{beam}{transverse-intensity} \begin{document}   \begin{tikzpicture}[     scale=2,     samples=50,     declare function={mu=1;},     declare function={sigma=0.3;},     declare function={normal(\m,\s)=1/(2*\s*sqrt(pi))*exp(-(\x-\m)^2/(2*\s^2));}   ]     \node at (1,1) {\pgfuseimage{beam}};     \draw plot[domain=0:2] (\x,{-normal(mu,sigma)});     \draw plot[domain=0:2,rotate around={90:(1,1)}] (\x,{-normal(mu,sigma)});   \end{tikzpicture}\end{document}
Attachments
The resulting output.
ytmp.png (4.68 KiB) Viewed 3694 times
The used graphics file.
transverse-intensity.png (2.11 KiB) Viewed 3694 times
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1

Posts: 25
Joined: Wed Sep 26, 2012 5:46 pm
@localghost
thanks, that looks very nice. that's exactly what i need.
using your code i get the gaussian profiles but not the image( doing something wrong): . An additional question: is there a possibilty to put axis boxes with some number around the image, for example as drawn in the image in red.

regards
Attachments
result.PNG (30.83 KiB) Viewed 3676 times

Johannes_B
Site Moderator
Posts: 3602
Joined: Thu Nov 01, 2012 4:08 pm
It is possible to get a frame around the function, but I don't want to mess with Thorstens code right now.
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany
thinkpadT wrote:[…] using your code i get the gaussian profiles but not the image( :? doing something wrong): […]

See Johannes' remarks. The exact code in form of a minimal example would be helpful (if it differs from my code sample). The code works for me. Hence there must be something that prevents its functionality on your machine.

thinkpadT wrote:[…] An additional question: is there a possibilty to put axis boxes with some number around the image, for example as drawn in the image in red. […]

Why do you come only bit by bit which such important information? We could have done this in one go right at the beginning. This will require a completely new approach. And there's another problem: It is weekend and very nice weather here. So don't expect a solution before Monday (from me).
LaTeX Community Moderator

¹ System: openSUSE 42.2 (Linux 4.4.52), TeX Live 2016 (vanilla), TeXworks 0.6.1