File Exchange

image thumbnail

Hydrogenic Wavefunction Visulization Tool

version (205 KB) by Jos Martin
Visualize hydrogenic wave-functions in 3D and watch animations of atomic state changes


Updated 01 Sep 2016

View Version History

View License

The code provides base functionality to calculate the wave-functions for hydrogen and visualise those wave-functions using iso-surfaces in 3D. This can be used to explore the spatial nature of the wave-functions.
In addition it is easy to calculate something approximating the wave-function of the atom whist undergoing a state transition (to make it easier to understand we assume the Rabi frequency is very slow). Then the wave-function of the atom can be visualised as a function of time whilst a transition is simulated. The transition GUI allows the user to program in any desired transition (even non-electric dipole transitions) and watch the evolution of the wave-function.

The animations clearly show why pi-transition emit linearly polarized light and sigma-transitions circular polarized light.

Developed in conjunction with Oxford Physics. Many thanks to Dr. David Lucas and Mr. Chris Ballance. The code in this submission was written by Chris Ballance whilst undertaking an internship at The MathWorks.

Cite As

Jos Martin (2021). Hydrogenic Wavefunction Visulization Tool (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)


The 2p m=1 and m=-1 states do not look correct compared to illustrations of these in textbooks. Should they not just be rotations of the m=0 state on to the x and y axis? It looks like it's plotting Y11(theta,phi) regardless of the value of m, rather than real(Y11(theta,phi)) for m=1 and imag(Y11(theta,phi)) for m=-1. (See for example).

Sebastien Montemurro

xinglong fang

Paul Kassebaum

Mr Smart


Hi, looking at your code again I noticed that in calculating psiNorm in line 168 in: "calculateHydrogenicWavefunction.m" you are missing a power of 3 over factorial(N+L), that is according to :introductory quantum mechanics" by Liboff, table 10.3


Hi, thanks for this contribution.
I am also using Hydrogen eigenfunction \psi=Ylm(\theta,\phi)*Rnl(r) and encountered a problem which I detect in this tool as well, regarding the file: "calculateHydrogenicWavefunction.m". It appears that your wavefunctions are not orthonormal... for example the inner-product of the wavefunctions for (N,L,M)=(2,1,0) and (3,1,0) does not vanish.
If psi1 is the matrix for (2,1,0) and psi2 is for (3,1,0) then sum(sum(sum(psi1*conj(psi2)))) is -2.7754. I suspect it has something to do with the implementation of the radial functions.
Is this a numerical by product? How can this be avoided?

Thanks a lot!

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!