Azzera filtri
Azzera filtri

MATLAB codes for Quantum physics state with given values?

2 visualizzazioni (ultimi 30 giorni)

Risposte (1)

Edoardo_a
Edoardo_a il 7 Mar 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 > '

Categorie

Scopri di più su Quantum Mechanics in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by