Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In this exercise, you will write a function trough_create that creates the vecto

ID: 3111935 • Letter: I

Question

In this exercise, you will write a function trough_create that creates the vectors y and y0 that form the outline for the cross-section of a trough. Input variables: Func - Any arbitrary function of x in MATLAB. eg. Func = @(x) x^2-4 EndPoint - The final value within the x vector. Output variables: - a linearly spaced vector with 64 elements. It starts at 0 and ends at EndPoint. y - the vector Func (x): y0 - a vector that has the same element as x, but where each element is equal to the initial value for y. Potentially Useful Functions: linspace, ones. Function Template: function [x, y, y0] = trough_create(Func EndPoint) % INSERT_CODE_HERE end Submitted file: function [x, y, y0): end trough_create(Func EndPoint) % INSERT_CODE_HERE end

Explanation / Answer

%%%% Matlab code for function %%%%%%%%%%%%

function [x,y,y0] = trough_create( Fun,EndPoint);
x=linspace(0,EndPoint,64);
y=feval(Fun,x);
y0=y(1)*ones(size(x));

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote