Plotting atomic orbitals on matlab

In summary, the conversation discusses plotting p(x) and d(xy) atomic orbitals on MATLAB using the surf and contour commands. The given equations for p(x) and d(xy) are provided, and the first step is to plot them on the xy plane with z=0. The conversation ends with the offer of assistance and the attached images of the plotted orbitals.
  • #1
Scientist94
10
0
Hi guys

I've been having some trouble plotting the p(x) and d(xy) atomic orbitals on Matlab.

I have been given that p(x) = x*e^-(x^2 + y^2 + z^2)^0.5

and d(xy) = x*y*e^-(x^2 + y^2 x^2)^0.5

Now I want to plot these orbitals on MATLAB using mesh or the surf command and then plot the corresponding contour plots with the contour command. Now the first stage is to just plot them on the xy plane setting z=0 (as a function of x and y) f(x,y).

Can anyone offer some advice on this?

Thanks
 
Physics news on Phys.org
  • #2
Here is a jumping off point. I plotted p(x,y,0) and d(x,y) using surfc(), which is a surf plot with contours. The images are attached below.

Let me know if you have questions!

Code:
px = @(x,y,z) x.*exp(-sqrt(x.^2+y.^2+z.^2));
dxy = @(x,y) x.*y.*exp(-sqrt(x.^2+y.^2.*x.^2));

[X,Y] = meshgrid(-4:0.2:4,-4:0.2:4);
Z = px(X,Y,0);
Z1 = dxy(X,Y);

figure;
surfc(X,Y,Z)
title('p(x,y,0)')

figure;
surfc(X,Y,Z1)
title('d(x,y)')
 

Attachments

  • dxy.png
    dxy.png
    12.3 KB · Views: 1,130
  • pxy0.png
    pxy0.png
    12.8 KB · Views: 1,435

Related to Plotting atomic orbitals on matlab

1. How do I plot atomic orbitals on MATLAB?

To plot atomic orbitals on MATLAB, you will need to use the "surf" function. First, you will need to generate a grid of x, y, and z coordinates using the "meshgrid" function. Then, use an appropriate atomic orbital function (such as "spherical harmonics") to calculate the values at each grid point. Finally, use the "surf" function to create a 3D plot of the orbital.

2. Can I plot multiple atomic orbitals on the same graph?

Yes, you can plot multiple atomic orbitals on the same graph by using the "hold" function in MATLAB. This will allow you to plot each orbital separately and then combine them on the same graph. You can also use different colors or line styles to differentiate between the different orbitals.

3. Is it possible to customize the appearance of the plotted atomic orbitals?

Yes, you can customize the appearance of the plotted atomic orbitals by using different options in the "surf" function. For example, you can change the color, transparency, and shading of the plot. You can also add labels, titles, and legends to make the plot more informative.

4. How can I compare the plotted atomic orbitals to theoretical values?

You can compare the plotted atomic orbitals to theoretical values by using the "plot3" function in MATLAB. This will allow you to plot the theoretical values as a line or points on the same graph as the plotted atomic orbitals. You can also calculate the error between the two sets of data to determine the accuracy of the plotted orbitals.

5. Can I save the plotted atomic orbitals as an image or file?

Yes, you can save the plotted atomic orbitals as an image or file in MATLAB by using the "saveas" or "print" functions. This will allow you to save the plot in various file formats (such as PNG, JPEG, or PDF) or to print it directly from MATLAB. You can also adjust the resolution and size of the saved image for better quality.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
11
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
3K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
14
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
Back
Top