Calculating the mathematical expression
Afficher commentaires plus anciens
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 commentaires
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
le 7 Mar 2022
Torsten
le 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
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Graphics Performance dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
