I'm trying to execute a set of elseif statements, but the third condition is not being recognized. Even when the value of v(i) is between vr and vco, the statement is returning the answer for the second condition.
for i=1:8760
if v(i)<vci || v(i)>vco
P(i)=0;
elseif vci<=v(i)<vr
P(i)=(0.5*1.225*18146*0.45*(v(i)^3))/10^3;
elseif vr<=v(i)<=vco
P(i)=Prated;
end
end

 採用された回答

Andrei Bobrov
Andrei Bobrov 2018 年 8 月 28 日

0 投票

for ii = 1:8760
if v(ii)<vci || v(ii)>vco
P(ii)=0;
elseif vci<=v(ii) && v(ii)<vr
P(ii)=(0.5*1.225*18146*0.45*(v(ii)^3))/10^3;
elseif vr<=v(ii) && v(ii)<=vco
P(ii)=Prated;
end
end

1 件のコメント

Vaishnav Pushpoth
Vaishnav Pushpoth 2018 年 8 月 28 日
That worked! I'm new to matlab. Thanks for helping me out.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeMATLAB についてさらに検索

製品

リリース

R2018a

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by