[go: up one dir, main page]

0% found this document useful (0 votes)
53 views1 page

Tutorial Octave 3

This document defines and plots the wavefunction of a particle in a 2D box. It sets up grids for x and y, defines the 1D particle-in-a-box wavefunction, and uses this to construct the 2D wavefunction as the product of the 1D wavefunctions. It then plots the 2D wavefunction as a contour and surface plot for a particle with quantum numbers nx=2 and ny=2 in a box of size Lx=1 and Ly=1.

Uploaded by

ash jay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views1 page

Tutorial Octave 3

This document defines and plots the wavefunction of a particle in a 2D box. It sets up grids for x and y, defines the 1D particle-in-a-box wavefunction, and uses this to construct the 2D wavefunction as the product of the 1D wavefunctions. It then plots the 2D wavefunction as a contour and surface plot for a particle with quantum numbers nx=2 and ny=2 in a box of size Lx=1 and Ly=1.

Uploaded by

ash jay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Exercises with Octave: Particle in 2D box

clear

x=0:0.01:1;

y=0:0.01:1;

#setting mesh along X, Y

[X,Y]=meshgrid(x,y);

#defining the wavefunction PIB-1d solution

function p=psi_pib(n,L,x); p=sqrt(2.0)* sin((n*pi/L)*x) ; end

#plotting nx=2,ny=2 wavefunction

nx=2;

ny=2;

Lx=1;

Ly=1;

#constructing psi_[nx,ny] (x,y)

psi=psi_pib(nx,Lx,X).* psi_pib(ny,Ly,Y) ;

#plot the function

surf(X,Y,psi)

#Make contour graphs

figure

contour(X,Y,psi,20)

You might also like