0% found this document useful (0 votes)
34 views1 page

Simpsons 1/3Th Rule: Input Program & Result

Uploaded by

YASH DOSHI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views1 page

Simpsons 1/3Th Rule: Input Program & Result

Uploaded by

YASH DOSHI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

SIMPSONS 1/3TH RULE

Table of Contents
INPUT .............................................................................................................................. 1
PROGRAM & RESULT ...................................................................................................... 1
Output ............................................................................................................................... 1
Solver ............................................................................................................................... 1

Name : Shubham Chapparghare Roll no. : 351013

INPUT
SC_SIMP13(0,10,10,@(x)(1./(1+x.^2)))

PROGRAM & RESULT


function[]=SC_SIMP13(x0,xn,n,fun)

y0=feval(fun,x0);
h=(xn-x0)/n;
yn=feval(fun,xn);
yeven=0;
yodd=0;
for i=1:2:(n-1)
yodd=yodd+feval(fun,(x0+i*h));
end
for i=2:2:(n-2)
yeven=yeven+feval(fun,(x0+i*h));
end
I=h/3*(y0+yn+(4*yodd)+(2*yeven));
fprintf('The value of given integration is %f\n',I);

The value of given integration is 1.431666

Output
The value of given integration is 1.431666

Solver
• quad(@(x)(1./(1+x.^2)),0,10,10)

• ans = 1.4657

Published with MATLAB® R2017a

You might also like