Question: MATLAB questions Given template: function [message,Area] = n9801758trough(Func,EndPoint) [x,y,y0] = trough_create(Func,EndPoint); trough_plot(x,y,y0) Area = trough_area(x,y,y0); message = trough_error(y); end function [x,y,y0] = trough_create(Func,EndPoint) %INSERT CODE

MATLAB questions

Given template:

function [message,Area] = n9801758trough(Func,EndPoint)

[x,y,y0] = trough_create(Func,EndPoint);

trough_plot(x,y,y0)

Area = trough_area(x,y,y0);

message = trough_error(y);

end

function [x,y,y0] = trough_create(Func,EndPoint)

%INSERT CODE

end

function trough_plot(x,y,y0)

%INSERT CODE

end

function Area = trough_area(x,y,y0)

%INSERT CODE

end

function message = trough_error(y)

%INSERT CODE

end

Inputs:

Func an arbitrary function that defines the bottom of the trough (eg. @(x) log(x+0.01) + exp(x))

EndPoint the second intersection point between Func(x) and Func(0) (for the previous example, EndPoint = 1.8627)

Outputs:

Area a numerical approximation for the area of the trough, given the upper bound is defined by Func(0) and the lower bound is defined by Func(x).

message a message based on the validity of the area that was calculated. The function should also output a plot of the trough cross-section.

This overall function can be broken into four parts - vector creation, plotting, area calculation and display messages. Each of these parts can be solved with a separate function. These functions can then be merged together to form the overall function.

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!