![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1516271/image.png)
plotting quantum harmonic oscillator
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
how can i plot probability density of quantum harmonic oscillator using matlab
0 Kommentare
Antworten (1)
Ayush
am 20 Okt. 2023
Hi Khaled,
I understand that you want to plot the probability density quantum harmonic oscillator.
Assuming the oscillator is a 1D oscillator, you can define the wave function for harmonic oscillator using the equation
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1516271/image.png)
as: “psi = (m * omega / pi)^(1/4) * exp(-0.5 * m * omega * x.^2);”
This is the wave function for the ground state of the harmonic oscillator. To find the above equation’s probability density, you can use “abs(psi).^2”. Refer the example code below for better understanding:
% Define the parameters of the harmonic oscillator
m = 1; % Mass
omega = 1; % Angular frequency
% Define the range of x values
x = linspace(-5, 5, 1000);
% Calculate the wave function
psi = (m * omega / pi)^(1/4) * exp(-0.5 * m * omega * x.^2);
% Calculate the probability density
probability_density = abs(psi).^2;
% Plot the probability density
plot(x, probability_density, 'LineWidth', 2);
xlabel('Position (x)');
ylabel('Probability Density');
title('Probability Density of Quantum Harmonic Oscillator');
grid on;
Feel free to adjust the range of x values or modify the parameters (“m” and “omega”) to explore different scenarios.
Hope it helps!
Regards,
Ayush
0 Kommentare
Siehe auch
Kategorien
Mehr zu Quantum Mechanics finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!