Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trapezoid Rule using For Loop Write an m - file to integrate the following function numerically, using the Trapezoid Rule for the interval of a

Trapezoid Rule using For Loop
Write an m-file to integrate the following function numerically, using the Trapezoid Rule for the interval of a=0 to b=5. Use for loop approach in your program.
y=x3+5x2
The program should prompt (ask) the user to input the number of divisions n before each tinge it runs.
Test the program by running it separately for the following four different n values.
n1=5,n2=10,n3=20,n4=100
Include the output for each trial and compare the results for increasing n values to the exact result and comment in terms of what happens when n value is increased and why?
Exact value of integration of the above function for the interval 0x5 is 364.6(no units, pure math problem).
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