How to plot this wave function into 2D or 3D polar coordinate?

Hi ! I have wave function for pz orbital
psi=1/sqrt(32*pi)*a0^(-5/2)*r*exp(-r/2*a0)*cos(theta)
for px orbital
psi=1/sqrt(32*pi)*a0^(-5/2)*r*exp(-r/2*a0)*sin(theta)*cos(phi)
there are many examples for plotting wave functions, but I want to use this wave function directly. help me please!!!

2 Comments

What do you want to plot?
I assume ‘psi’ is your dependent variable. What is or are your independent variables?
Are any values constants? Are they vector constants or scalar constants?
a0 is a constant, theta is an indipendent variable, r is dependent variable. I tried to express r as theta, but failed. 'psi' is probability, so we can plot this with assume psi=constant so that there are a relation between r and theta.

Sign in to comment.

Answers (2)

I have no idea what you are doing.
This runs, although having the correct values for the constants will likely produce better results than I got:
psi = 0.5; % Use The Correct Value
phi = 0.5; % Use The Correct Value
a0 = 42; % Use The Correct Value
pzfcn = @(theta,r) psi - (1/sqrt(32*pi)*a0^(-5/2)*r.*exp(-r/2*a0).*cos(theta));
pxfcn = @(theta,r) psi - (1/sqrt(32*pi)*a0^(-5/2)*r*exp(-r/2*a0)*sin(theta)*cos(phi))
thta = linspace(0, 2*pi);
for k1 = 1:numel(thta)
rz(k1) = fzero(@(r) pzfcn(thta(k1),r), 0.001);
rx(k1) = fzero(@(r) pxfcn(thta(k1),r), 0.001);
end
figure(1)
polarplot(thta, rz)
hold on
polarplot(thta, rx)
hold off
The code is relatively straightforward, so I will not document it further.
Experiment to get the result you want.
psi = 0.5; % Use The Correct Value
phi = 0.5; % Use The Correct Value
a0 = 42; % Use The Correct Value
pzfcn = @(theta,r) psi - (1/sqrt(32*pi)*a0^(-5/2)*r.*exp(-r/2*a0).*cos(theta));
pxfcn = @(theta,r) psi - (1/sqrt(32*pi)*a0^(-5/2)*r*exp(-r/2*a0)*sin(theta)*cos(phi))
thta = linspace(0, 2*pi);
for k1 = 1:numel(thta)
rz(k1) = fzero(@(r) pzfcn(thta(k1),r), 0.001);
rx(k1) = fzero(@(r) pxfcn(thta(k1),r), 0.001);
end
figure(1)
polarplot(thta, rz)
hold on
polarplot(thta, rx)
hold off

Asked:

on 26 May 2018

Answered:

on 10 Nov 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!