Calculating the mathematical expression
Show older comments
I have to calculate the value of an expression (x) for a range of inputs y and z and plot the output separately with respect to y and z. How do I do this?
y = [1,1000,50];
z = [1,1000,50];
x = 55*y^(3/2) + 10*z^(4);
3 Comments
x = 55*y.^(3/2) + 10*z.^(4);
will produce the following (1x3) vector for x:
[55*y(1)^(3/2) + 10*z(1)^(4),55*y(2)^(3/2) + 10*z(2)^(4),55*y(3)^(3/2) + 10*z(3)^(4)]
Amy Topaz
on 7 Mar 2022
Torsten
on 7 Mar 2022
Sure. You can also use a loop:
n = numel(y);
x = zeros(1,n);
for i = 1:n
x(i) = 55*y(i)^(3/2) + 10*z(i)^(4);
end
x
Accepted Answer
More Answers (0)
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!