Numerical integration using Simpsons
1 view (last 30 days)
Show older comments
mohammed shapique
on 10 Nov 2020
Answered: Alan Stevens
on 10 Nov 2020
Simpsons numerical integration to evalaute
lambda=0.0:0.1:1
mu2=0.5;
gamma2=0.7;
zeta=0.1;
a=0;%lower limit
b=1;%upper limit
n=10;%number of sub-intervals
h=(b-a)/n;
f3=@(x,p)(x.^((mu2/zeta)-1)).*((1-x).^((gamma2./zeta))).*(exp(-(lambda(p).*x)./zeta));
for p = 1:numel(lambda)
for k=1:n
x(k)=a+k*h;
y(k)=f3(x(k),p);
end
so=0;se=0;
for k=1:n-1
if rem(k,2)==1
so=so+y(k);%sum of odd terms
else
se=se+y(k); %sum of even terms
end
end
I3(p)=h./3.*(f3(a,p)+f3(b,p)+4.*so+2.*se)
end
For 11 values of lambda, i am getting 61 solutions. Please help me to find the error.
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Numerical Integration and Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!