MATLAB codes for Quantum physics state with given values?

1 visualización (últimos 30 días)
Zar
Zar el 8 de Feb. de 2023
Respondida: Edoardo_a el 7 de Mzo. de 2023

Respuestas (1)

Edoardo_a
Edoardo_a el 7 de Mzo. de 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 > '

Categorías

Más información sobre Quantum Mechanics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by