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!
