# Plotting Complex Wavefunction - Matlab

1. Oct 16, 2015

### Nicolaus

Hi,
I am wondering how to plot a complex function of the form:
Ψ(t) = Ansin(n⋅pi⋅x/L)e-iEnt/h + Bnsin(m⋅pi⋅x/L)e-iEmt/h + .... +
where m and n are known eigenvalues of the infinite square well with corresponding energy En, for any particular x? So, this will be a function of solely t.
Any help appreciated,
Thanks.

2. Oct 17, 2015

### blue_leaf77

Does "+...+" mean infinite series? If yes you can't plot it in a computer, you first have to know which terms have more weight than the others and plot only those significant terms.

3. Oct 17, 2015

### Nicolaus

I should have specified; my intent was not for that to represent an infinite series, but rather other arbitrary terms for a linear combination of a finite number of energy eigenfunctions of the infinite square well.

4. Oct 17, 2015

### blue_leaf77

If I get your point correctly, you want to plot your wavefunction for a fixed x as a function of t, and this wavefunction is a linear combination of finite number of eigenfunctions of infinite square well.
Well, the wavefunction is a complex number, hence it can be either written in terms of its real and imaginary parts, or modulus and phase. So, you will have two curves for $\psi(x,t)$, one for real part $\textrm{Re}[\psi(x,t)]$ and one for imaginary part $\textrm{Im}[\psi(x,t)]$, if you use real-imaginary representation. If you use modulus-phase, they will be $|\psi(x,t)|$ and $\textrm{Arg}(\psi(x,t))$

5. Oct 18, 2015

### Nicolaus

Correct. If I want a Re-Im representation, how would I go about plotting that on Matlab? Actually, it would be good to know how to plot both types.
Thanks

6. Oct 18, 2015

### blue_leaf77

Given $Z$ a complex number, then its real part, imaginary part, modulus, and phase can be accessed through
Code (Matlab M):
real(Z);
imag(z)
abs(Z)
angle(Z)

, respectively.