MATLAB codes for Quantum physics state with given values?

조회 수: 1 (최근 30일)
Zar
Zar 2023년 2월 8일
답변: Edoardo_a 2023년 3월 7일

답변 (1개)

Edoardo_a
Edoardo_a 2023년 3월 7일
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 > '

카테고리

Help CenterFile Exchange에서 Quantum Mechanics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by