Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The algorithm shown below estimates the value of a b f ( x ) d x using the composite trapezoid rule with n equally or

The algorithm shown below estimates the value of
abf(x)dx
using the composite trapezoid rule with n equally or unequally spaced base points (xi,yi)
BEGIN
INPUT xi,yi,n
sum =0
DOFOR i=1,n-1
??=??+(xi+1-xi)yi+1+yi2
ENDDO
OUTPUT sum
END
a) Represent the algorithm as a flow chart.
b) Write a Matlab function program TrapRule (x,y,n) which implements this algorithm and
returns the estimated value of the integral to the calling program.
c) Write a Matlab program which calls the function program developed in part (b) to evaluate the
integral
02xcos(x)dx
using 4 equally spaced base points and prints the result.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Concepts

Authors: David M Kroenke, David J Auer

6th Edition

0132742926, 978-0132742924

More Books

Students also viewed these Databases questions

Question

1. Prepare a flowchart of Dr. Mahalees service encounters.

Answered: 1 week ago