Skip to content

Instantly share code, notes, and snippets.

@sash13
Forked from stdray/yoba.m
Last active May 22, 2016 16:35
Show Gist options
  • Save sash13/4fd9a21c8f36c06ab83f0279186ef9bc to your computer and use it in GitHub Desktop.
Save sash13/4fd9a21c8f36c06ab83f0279186ef9bc to your computer and use it in GitHub Desktop.
m_e = 9.10938356 * 10 .^-31;
E = 10;
alpha = 1;
from = 0;
to = 1000;
v0 = 0.5 .* 299792458;
p = m_e * v0;
w = @(x) x .* exp(-alpha .* x);
N2 = @(x) integral(w, from, to) ;
U = @(x) 10 .* x ;
Ham = @(x) p .^ 2 / 2 .* m_e + U(x);
J = @(x) integral(@(x) w(x) .* Ham(x) .* w(x) , from, to);
fun = @(x) J(x) / N2(x);
fplot(fun, [0 0.1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment