Question: Write a MATLAB SUBROUTINE which will accomplish numerical integration by the Trapezoidal rule. the SUBROUTINE should have the following capabilities: Compute the step-size based on

Write a MATLAB SUBROUTINE which will accomplish numerical integration by the Trapezoidal rule. the SUBROUTINE should have the following capabilities: Compute the step-size based on the endpoints of the domain and the number of steps required. Step-size should also be specified in the first data record of the related calling program. Accept the values for the function to be integrated. Return the result of the integration to the main program for further manipulation or for output by the main program. function [integral] = trap_integrate(ypoints, xstart, xstop, num_steps) Once the subroutine is written, write a MATLAB test program that uses the subroutine from integration of either (1) from an external data file or (2) from an array filled by the calling program and passed to the subroutine in the calling argument list. the latter capability will permit the user to generate function values by means of a FUNCTION subprogram in the calling program. Test your SUBROUTINE as follows: a) By preparing a data file which represents the function/f(x) = 2x^2 - 1 for 0
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
