How to do this script on matlab. Keep getting errors. Thanks The below expressio
ID: 1857088 • Letter: H
Question
How to do this script on matlab. Keep getting errors. Thanks
The below expression is a function of three variables x, y, and t. Let t vary from 0 to 1 in increments of 0.1, x from 1 to 11 in increments of 1, and y from 20 to 25 in increments of 0.5. Using element by element operations, calculate the values for z. Display in a table format in columns the four variables t, x, y, z. Also, using built-in functions, find the mean of z, and the maximum and minimum values of z, and display the output for the mean, max, and min. z=[(y2)*(t2)/(X3)Explanation / Answer
%The required script is as shown below (copy it --> save as .m file --> run it and enjoy.):
clc
clear all
t = 0:0.1:1;
x = 1:1:11;
y = 20:0.5:25;
z = ((y.^2) + (t.^2))./(x.^3);
n = length(z);
for i = 1:n
data (i,1) = t(i);
data (i,2) = x(i);
data (i,3) = y(i);
data (i,4) = z(i);
end
disp('The four variables t,x,y,z in tabular format are as follow:');
disp(data);
mean = sum(z)/n;
max_z = max(z);
min_z = min(z);
disp('The mean of z:')
disp(mean);
disp('The maximum value of z:')
disp(max_z);
disp('The minimum value of z:')
disp(min_z);
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.