This is a MATLAB question please help If possible show how t
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.Solution
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);
