Calculating the mathematical expression
古いコメントを表示
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 件のコメント
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
2022 年 3 月 7 日
Torsten
2022 年 3 月 7 日
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
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Graphics Performance についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
