MATLAB codes for Quantum physics state with given values?

1 Ansicht (letzte 30 Tage)
Zar
Zar am 8 Feb. 2023
Beantwortet: Edoardo_a am 7 Mär. 2023

Antworten (1)

Edoardo_a
Edoardo_a am 7 Mär. 2023
I wrote this function, you just have to indicate the value for alpha (alpha_val) and n (n_val).
I hope it helps.
function [Alpha] = alp(alpha_val,n_val)
Alpha = zeros(1);
for i = 0 : 1 : n_val
Alpha = Alpha + (exp(-.5*abs(alpha_val)^2)/alpha_val^i)/sqrt(factorial(i));
end
sprintf('%c ', 945, '=', Alpha, '|n>')
end
alp(0.1,30)
ans =
'α = 1.320248e+14 | n > '
alp(0.2,30)
ans =
'α = 1.007363e+06 | n > '
alp(0.3,30)
ans =
'α = 1.004035e+03 | n > '
alp(0.4,30)
ans =
'α = 73.3975 | n > '
alp(0.5,30)
ans =
'α = 20.1727 | n > '

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!

Translated by