nick_name
nick_name

Reputation: 1373

MATLAB - 3D Contour Plot (Hydrogen 2p Orbitals)

I've got the following code which works for plotting an x-y slice of the Hydrogen 2pz orbital:

%probability densities
pd_psi_210 = @(r,theta,phi) exp(-r).*(r.^2).*(cos(theta).^2)/(32*pi);

%configuring the range
[x y z] = meshgrid(-10:.1:10,-10:.1:10,-2:.1:2);
[THETA,PHI,R] = cart2sph(x,y,z);

%create array of probability density magnitudes
psi_210_vals = pd_psi_210(R,THETA,PHI);

%plotting
imagesc(psi_210_vals(:,:,1)); %x-y plane

I'd like to plot the 3d contour plot of the orbital. I've tried this (and it doesn't seem to get me what I wanted):

isosurface(psi_210_vals(:,:,:)); %3D contour

How can I get this to work?

Upvotes: 4

Views: 3841

Answers (1)

John Colby
John Colby

Reputation: 22588

You just have to specify the underlying grid, and the level you want. For example:

>> isosurface(-10:.1:10, -10:.1:10, -2:.1:2, psi_210_vals, 0.001);
>> axis equal

enter image description here

Upvotes: 6

Related Questions