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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started