how to use <= or >= (greater than or equal to) in 'for statements '?

2 次查看(过去 30 天)
I want to use these equations in matlab. But it says parse error and might me invalid in matlab.
P = 0.73*x-103.43; for (x>= 141.9)
and
P = 0.06*x-8.04; for (x< 141.9)

采纳的回答

Matt J
Matt J 2020-2-28
编辑:Matt J 2020-2-28
P=nan(size(x));
region=(x>=141.9);
P(region) = 0.73*x( region )-103.43;
P(~region) = 0.06*x( ~region )-8.04;

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by