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

Simpsons 3/8Th 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)
39 views1 page

Simpsons 3/8Th 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 3/8TH RULE

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

Name: Shubham Chapparghare Roll no. : 351013

Input
SC_SIMP38(0,10,10,@(x)(1./(1+x.^2)))

PROGRAM & RESULT


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

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

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