Skip to content

Commit

Permalink
MATLAB_Comparison_4
Browse files Browse the repository at this point in the history
  • Loading branch information
fobos123deimos committed Jul 23, 2024
1 parent 7581d95 commit 56cce4e
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 0 deletions.
Binary file not shown.
Binary file modified exemples/MATLAB_Comparison/MATLAB_Wavefunction_Comparison.pdf
Binary file not shown.
Binary file not shown.
18 changes: 18 additions & 0 deletions exemples/MATLAB_Comparison/wavefunction_MATLAB_3.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function wavefunction = wavefunction_MATLAB_3(n,x,prec)

digits(prec);
x = vpa(x);
x_size = numel(x);

wavefunction = vpa(zeros(x_size, n+1));

for index = 1:n+1

norm = (2^(-0.5*vpa(index-1))) * (gamma(vpa(index-1)+1)^(-0.5)) * (pi^(-0.25));

H = hermiteH(vpa(index-1),x);

wavefunction(:,index) = norm * exp(-0.5 * x^2) * H;
end

end
18 changes: 18 additions & 0 deletions exemples/MATLAB_Comparison/wavefunction_MATLAB_4.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
function wavefunction = wavefunction_MATLAB_4(n,x,prec)

digits(prec);
x = vpa(x);
x_size = numel(x);

wavefunction = vpa(zeros(n+1, x_size));

for index = 1:n+1

norm = (2^(-0.5*vpa(index-1))) * (gamma(vpa(index-1)+1)^(-0.5)) * (pi^(-0.25));

H = hermiteH(vpa(index-1),x);

wavefunction(index,:) = norm * exp(-0.5 * x.^2) .* H;
end

end

0 comments on commit 56cce4e

Please sign in to comment.