LaTeX forum ⇒ Graphics, Figures & TablesTransverse Intensity Profile of a Laser Beam

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

Transverse Intensity Profile of a Laser Beam

Postby thinkpadT » Sun Jun 02, 2013 2:06 pm

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.

Thanks in advance
Attachments
image3.png
image3.png (16.86 KiB) Viewed 3768 times
traverse-int.JPG
traverse-int.JPG (2.79 KiB) Viewed 3768 times

Tags:

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Mon Jun 03, 2013 10:31 am

The simplest solution I can think of is one with TikZ/PGF. It could look like this. The output is attached.
  1. \documentclass[11pt]{standalone}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{tikz}
  4.  
  5. \begin{document}
  6. \begin{tikzpicture}[
  7. scale=3,
  8. samples=50,
  9. declare function={mu=2;},
  10. declare function={sigma=0.3;},
  11. declare function={normal(\m,\s)=1/(2*\s*sqrt(pi))*exp(-(\x-\m)^2/(2*\s^2));}
  12. ]
  13. \path[inner color=red] (1,1) rectangle (3,3);
  14. \draw plot[domain=1:3] (\x,{normal(mu,sigma)});
  15. \draw[rotate=90] plot[domain=1:3] (\x,{-normal(mu,sigma)});
  16. \end{tikzpicture}
  17. \end{document}

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


Thorsten
Attachments
ytmp.png
ytmp.png (8.22 KiB) Viewed 3753 times
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


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

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

Postby thinkpadT » Tue Jun 04, 2013 2:27 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

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Tue Jun 04, 2013 6:28 pm

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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


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

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

Postby thinkpadT » Wed Jun 05, 2013 11:08 am

@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

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Wed Jun 05, 2013 7:33 pm

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.
  1. \documentclass[11pt]{article}
  2. \usepackage[T1]{fontenc}
  3. \usepackage{tikz}
  4.  
  5. \pgfdeclareimage[height=4cm]{beam}{transverse-intensity}
  6.  
  7. \begin{document}
  8. \begin{tikzpicture}[
  9. scale=2,
  10. samples=50,
  11. declare function={mu=1;},
  12. declare function={sigma=0.3;},
  13. declare function={normal(\m,\s)=1/(2*\s*sqrt(pi))*exp(-(\x-\m)^2/(2*\s^2));}
  14. ]
  15. \node at (1,1) {\pgfuseimage{beam}};
  16. \draw plot[domain=0:2] (\x,{-normal(mu,sigma)});
  17. \draw plot[domain=0:2,rotate around={90:(1,1)}] (\x,{-normal(mu,sigma)});
  18. \end{tikzpicture}
  19. \end{document}
Attachments
ytmp.png
The resulting output.
ytmp.png (4.68 KiB) Viewed 3699 times
transverse-intensity.png
The used graphics file.
transverse-intensity.png (2.11 KiB) Viewed 3699 times
LaTeX Community Moderator
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


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

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

Postby thinkpadT » Fri Jun 07, 2013 10:40 am

@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
result.PNG (30.83 KiB) Viewed 3681 times

User avatar
Johannes_B
Site Moderator
Posts: 3602
Joined: Thu Nov 01, 2012 4:08 pm

Postby Johannes_B » Fri Jun 07, 2013 10:52 am

It is possible to get a frame around the function, but I don't want to mess with Thorstens code right now.
Concerning the image: Can you please provide us with more information, is there any error message?
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.

User avatar
localghost
Site Moderator
Posts: 9206
Joined: Fri Feb 02, 2007 12:06 pm
Location: Braunschweig, Germany

Postby localghost » Fri Jun 07, 2013 4:27 pm

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
How to make a "Minimal Example"
Board Rules
Avoidable Mistakes


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


Return to “Graphics, Figures & Tables”

Who is online

Users browsing this forum: No registered users and 11 guests