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

This is a MATLAB question please help. If possible show how to put in an M file

ID: 3928492 • Letter: T

Question

This is a MATLAB question please help. If possible show how to put in an M file thank you. will rate fast

a) Consider the following function: 4 It is desired that this function be evaluated for a variety of user-defined values of x. Create a script file/segment of code that will allow the user to neatly and professionally input a scalar OR vector value of x. Evaluate the function at 3 user- selected points as well as a single user-defined vector input. Display the result using dispO. Be sure to include some output text in addition to displaying the function evaluation result.

Explanation / Answer

Here is the code. It takes 3 scalar inputs and a vector input and gives the result.

i=1;
while(i<=3)
prompt='Enter scalar input for x:';
x = input(prompt);
y=exp( 3*x.^2 + ((4/5)*x))+ 36*x +1;
disp('Answer for Scalar');
disp(x);
disp(' is:');
disp(y);
i=i+1;
end

z = [];
n=input('Input vector size');
while (n>=1)
z(end+1) = input('Input Element: ');
n=n-1;
end
w=exp( 3*z.^2 + ((4/5)*z))+ 36*z +1;
disp('Answer for Vector');
disp(z);
disp(' is:');
disp(w);

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