In this exercise, you will be writing the function y_intercept, which returns th
ID: 3167412 • Letter: I
Question
In this exercise, you will be writing the function y_intercept, which returns the y-intercept of an input function.
Inputs:
Func - an arbitrary function. eg. @(x) x.^2 + 4. Note that the @(x) indicates we are creating a function (@ is what we call the function handle), with an independent variable of x.
Outputs:
Y0 - The y-intercept of Func
Process:
To find the y-intercept of the input function, we simply find the value of the input function when its input is 0. To do this, we can treat it like any other function in MATLAB, by putting the input value inside of brackets that come after the function name.
Function Template:
function Y0 = y_intercept(Func)
% uncomment the line below before submitting.
% Y0 = Func(0);
end
Explanation / Answer
% Matlab Code to return y_intercept
function Y0 = y_intercept(Func)
Y0 = Func(0);
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.