Complete the function using matlab In this exercise, you will be writing the fun
ID: 3885589 • Letter: C
Question
Complete the function using matlab
In this exercise, you will be writing the function y_intercept, which returns the y-intercept of an input function. Inputs: Func - an arbitrary @(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: YO - 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): endExplanation / Answer
% Save this in 'y_intercept.m' file
function Y0 = y_intercept(Func)
Y0 = Func(0);
end
To test the function you can try this:
In the scripting window type the following:
> F = @(x) x^2 - 3;
> y_intercept(F);
1.73205
If you need any help, please comment below :)
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.