Hi all, i'm trying to prove the Lorentzian Profile is Unit Normalized (i.e = 1) VIA Simpsons Rule of Integration. The constants are the given parameters
Here is my functon/code:
function s=simprl(f,a,b,M)h=(b-a)/(2*M);s1=0;s2=0;for k=1:M x=a+h*(2*k-1); s1=s1+f(x);endfor k=1:(M-1) x=a+h*2*k; s2=s2+f(x);ends=h*(f(a)+f(b)+4*s1+2*s2)/3;
here is my function that i am calling with the given parameters entered in, it should equal to 1
simprl(@(x) (1./pi).*((5e8)./2)./(x-4.5667e14).^2 + ((4.5667e14)./2).^2,-Inf,Inf,2)
It should equal to 1, but instead it is giving me a "NaN" answer. What is wrong?
Best Answer