Skip to content

Instantly share code, notes, and snippets.

@stdray
Created June 21, 2016 14:01
Show Gist options
  • Save stdray/1fe8b2ad14294f867ce2746e886f8371 to your computer and use it in GitHub Desktop.
Save stdray/1fe8b2ad14294f867ce2746e886f8371 to your computer and use it in GitHub Desktop.
function Triangle_well()
clear all, clc;
%https://ru.wikipedia.org/wiki/%D0%90%D1%82%D0%BE%D0%BC%D0%BD%D0%B0%D1%8F_%D1%81%D0%B8%D1%81%D1%82%D0%B5%D0%BC%D0%B0_%D0%B5%D0%B4%D0%B8%D0%BD%D0%B8%D1%86
h = 1;
e = 1;
m = 1;
EH = 4.3597441775*10^-18; %Хартри
E = 100000 / (5.1422065211.*10.^11);
warning('off', 'MATLAB:integral:NonFiniteValue');
w = @(x, a) x.*exp(-a.*x);
w_ = @(x, a) exp(-a.*x) - a.*x.*exp(-a.*x);
U = @(x) e.*E.*x;
No = @(a) integral(@(x) w(x,a).^2, 0, inf); %normalization
J1 = @(a) h^2/(2*m) * integral(@(x) w_(x, a).^2, 0, inf);
J2 = @(a) integral(@(x) U(x) .* w(x, a).^2, 0, inf);
J = @(a) J1(a) + J2(a);
E_F = @(a) J(a)/No(a);%total evergy
E_F_SI = @(a) E_F(a)/ EH; %total evergy
amin = 0;
amax = 0.04;
a0 = fminbnd(E_F, amin, amax);
display(a0);
display(E_F_SI(a0));
hold on;
fplot(E_F, [amin amax]);
axis([amin, amax, 0, 0.001])
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment