Question: Im stuck ! Thank you Code Ive done is underneath it will complete A-E. I need F,G , 2 and 3 --------------------------------------------------Trap.m-------------------------------------------- %Define a symbolic

 Im stuck ! Thank you Code Ive done is underneath it

Im stuck ! Thank you

Code Ive done is underneath it will complete A-E. I need F,G , 2 and 3

--------------------------------------------------Trap.m--------------------------------------------

%Define a symbolic variable %Define a symbolic Function %call trap function program

function I = trap(func, a, b, n, varargin) % program is trap setting the function a = Upper bound, b = lower bound, n = amount of trapezoids % inputs: % func = name of function to be integrated % a, b = integration limits % n = number of segments (default = 100) % outputs: % I = integral estimate if nargina) % states that the upper cant be greater then the lower bound and prints error error ('upper bound must be greater than lower') % prints upper bound must be greater than lower once error is found end if nargin

True_value=double(-1*(int(func,-108,80)));% takes the intragral and finds the real value

for k=1:n True_Error(k,1)=True_value-Estimate(k,1) AbsRelTruePercentError(k,1)=(abs(True_value-Estimate(k,1))/True_value)*100 end

for c=2:n AbsApproxRelPrecentError(c,1)=(abs(Estimate(c,1)-Estimate(c-1,1))/Estimate(c,1))*100 end

table(index,Estimate, True_Error,AbsRelTruePercentError,AbsApproxRelPrecentError)

--------------------------------------------------------------Labtrap.m------------------------------------

syms T f = symfun(((-1.2278*10.^-11).*(T.^2)+6.1946*10.^-6).*T + 6.015*10.^6,T); trap(f,-180,80,8)

Use the provided MATLAB code for the n segment Trapezoidal Rule for Numerical Integration to solve Example Problem 2 Submit the following 1) Modified code (highlight the modifications) that accomplishes the following tasks: a. b. c. d. e. f. Calculates the true value Calculates the true error Calculates the absolute relative true percent error Calculates the absolute relative approximate percent error Generates Table 1 Generates a subplot which consists of a plot of the approximations vs the iterations, a plot of the absolute relative true percent error vs the iterations, and a plot of the absolute relative approximate percent error vs the iteration:s Comments for each line of code g. 2) Table 1 3) The subplot with the required plots Use the provided MATLAB code for the n segment Trapezoidal Rule for Numerical Integration to solve Example Problem 2 Submit the following 1) Modified code (highlight the modifications) that accomplishes the following tasks: a. b. c. d. e. f. Calculates the true value Calculates the true error Calculates the absolute relative true percent error Calculates the absolute relative approximate percent error Generates Table 1 Generates a subplot which consists of a plot of the approximations vs the iterations, a plot of the absolute relative true percent error vs the iterations, and a plot of the absolute relative approximate percent error vs the iteration:s Comments for each line of code g. 2) Table 1 3) The subplot with the required plots

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!