Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Paste Published Solution using MATLAB Create a function called intpoly( ) that can numerically integrate the polynomial function y = ax2 + bx + c

Paste Published Solution using MATLAB

Create a function called intpoly( ) that can numerically integrate the polynomial function y = ax2 + bx + c from a lower limit to an upper limit, where a, b, and c are constants. Your numerical integrator must allow the user to use the Trapezoidal method or Riemann sums method (as we used in discussion) depending on the choice of the user. If the value of choice is 1, the Riemann sums method will be used to numerically integrate the polynomial (you may use either a left, right, or midpoint Riemann sums method). If the value of choice is 2, the Trapezoidal method will be used to numerically integrate the polynomial.

The main program calls the function intpoly( ) and has the following form:

% numerically integrate y(x) = ax^2 + bx + c

% from lowerlimit to upperlimit

a = 2; b = 2; c = 1;

% from 0 to 1

lowerlimit = 0;

upperlimit = 1;

% number of discretizations

N = 1000;

% choice: 1 = Riemann, 2 = Trapezoidal

choice = 2;

disp( intpoly(a,b,c,lowerlimit,upperlimit,N,choice) )

The arguments passed down to intpoly( ) are the polynomial coefficients (a,b,c), the lower and upper limits of integration (lowerlimit,upperlimit), the number of discretizations (N), and the method of integration (choice). The area is returned to the main program.

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

Sybase Database Administrators Handbook

Authors: Brian Hitchcock

1st Edition

0133574776, 978-0133574777

More Books

Students also viewed these Databases questions

Question

Describe the five elements of the listening process.

Answered: 1 week ago