Calculating the mathematical expression
Mostra commenti meno recenti
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 Commenti
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
il 7 Mar 2022
Torsten
il 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
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Graphics Performance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
