In Matlab: Consider the multi-variable function given by: allow the user to inpu
ID: 3933929 • Letter: I
Question
In Matlab:
Consider the multi-variable function given by:
allow the user to input scalar values for x, y, and z and include logic that will stop the script and display an error message if the function is singular or would result in an imaginary number for a provided set of x,y,z. If the function is allowed to evaluate, display the entered values of x,y, and z as well as the value of the function using a single instruction. ?Otherwise, display an error message. Evaluate at the following points (x,y,z):
i. (4,13,15)
ii. (8,-12,0.1)
iii. (0,0,0)
iv. (5,10,15)
Explanation / Answer
x = input('Enter x: ');
y = input('Enter y: ');
z = input('Enter z: ');
if x + y + z == 0
disp('Undefined value of function');
elseif 5 * z * z + x * y * y * y < 0
disp('Imaginary value of function');
else
disp(((36 * x * y) + sqrt(5 * z * z + x * y * y * y)) / (x + y + z));
end
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.