MATLAB_Quantum Well_Finite Difference Method

In summary: So, in MATLAB, you would writefor j = 1:Nh[j] = diag(h[j-1], h[j+1], h[j+2], h[j+3], ..., h[j+N-1])In summary, The student is trying to figure out how to code a matrix with different diagonals. The "diag" function only gives you the option of changing one diagonal like if instance diag(-2) makes the k0 diagonal "-2" and diag(1,1) makes the k1 diagonal "1".
  • #1
csc
2
0

Homework Statement


Hi,
I am new to MATLAB and have an assignment where I have to construct a Hamiltonian matrix, apply boundary conditions, then find corresponding eigenvalues and eigenvectors for the electron in a box problem. I am stumped where to start. From our class we learned that you will get to the equation
-h_bar^2/2m[psi_(i+1)-2psi_(i)-psi_(i-1)] by using the definition of a derivative and can use the boundary conditions to manipulate this equation to give you the coefficients to use in the hamiltonian matrix, however, it does not seem like we need this because it will be applied when we set the limits for the Hamiltonian. Any advice on a good start would be greatly appreciated.
Attached is the pdf of the problem.

Homework Equations


HΨ=EΨ

The Attempt at a Solution


I was suggested by my professor to start here:

In your code, you have to create an empty matrix that you will use as a Hamiltonian (let’s call H), and then assign the elements. For example, in MATLAB, you can do something like below.

H(1,1) = -2*t_0;
H(1,2) = t_0;
H(1,3) = 0;
H(1,4) = 0;

I believe you know what t_0 is. Since we don’t want to do all this manually one by one, you can use “for” or “while” syntax to define H more easily. Once you fill up H correctly (remember, when you do this, you would have already applied the boundary condition. Review how different boundary conditions have resulted in different Hamiltonian), you simply perform eig function. To do this, you will need to create two empty matrixes that will contain the calculated eigen vectors and eigen values. In your previous email, you said you learned how to use [V, D] = eig (H). So, for example, V will contain the eigen vectors (eigen functions) and D will contain the eigen values after you execute the line in your code.

You know that you have to define many “constants” in your code. t_0 contains del_x which is the lattice spacing (I think I used del_x in my lecture instead of a, but here I mean del_x by a. N is the number of total lattice points (=100). So the situation is something like this. (see attached picture)
 

Attachments

  • PastedGraphic-1.jpg
    PastedGraphic-1.jpg
    17.1 KB · Views: 372
  • HW_3(1).pdf
    84.1 KB · Views: 257
Physics news on Phys.org
  • #2
Your teacher has given a very nice and quite detailed procedure on how to start the problem. There is not much more to add.
 
  • #3
DrClaude said:
Your teacher has given a very nice and quite detailed procedure on how to start the problem. There is not much more to add.
How do I do a for loop in MATLAB in order to make the k0 diagonal -2, k-1 diagonal 1, and k+1 diagonal 1? I understand the physics behind it just not how to code a matrix that has different diagonals. The "diag" function only gives you the option of changing one diagonal like if instance diag(-2) makes the k0 diagonal "-2" and diag(1,1) makes the k1 diagonal "1".
 
  • #4
There is a repeating pattern. Consider an NxN matrix: looping over i from 1 to N allows you to set the values of the matrix row by row.
 

What is MATLAB?

MATLAB is a high-level programming language and interactive environment commonly used by scientists and engineers for data analysis, visualization, and numerical computation.

What is a quantum well?

A quantum well is a region in a semiconductor material where the electron motion is confined in one or more dimensions, resulting in discrete energy levels. This type of structure is used in electronic and optoelectronic devices.

What is the Finite Difference Method?

The Finite Difference Method is a numerical technique for solving differential equations by approximating derivatives with finite differences. It is commonly used in engineering and scientific applications to solve problems that cannot be solved analytically.

How can MATLAB be used to simulate a quantum well using the Finite Difference Method?

MATLAB has built-in functions and toolboxes that allow for the creation and manipulation of matrices, which are essential for implementing the Finite Difference Method. By defining the necessary equations and boundary conditions, MATLAB can be used to solve for the energy levels and wavefunctions of a quantum well system.

What are some potential applications of using MATLAB for simulating quantum wells?

MATLAB can be used to simulate the behavior of quantum wells in various scenarios, such as in optoelectronic devices like lasers and solar cells, or in quantum computing. It can also be used to study the effects of different parameters on the behavior of quantum wells, providing valuable insights for further research and development.

Similar threads

  • Introductory Physics Homework Help
Replies
1
Views
998
  • Engineering and Comp Sci Homework Help
Replies
5
Views
1K
  • Other Physics Topics
Replies
1
Views
2K
  • Introductory Physics Homework Help
Replies
1
Views
888
  • Quantum Physics
Replies
2
Views
970
  • Introductory Physics Homework Help
Replies
5
Views
3K
  • Quantum Physics
Replies
21
Views
402
  • Differential Equations
Replies
3
Views
2K
Replies
3
Views
812
  • Advanced Physics Homework Help
Replies
4
Views
2K
Back
Top