フィルターのクリア

Not getting proper output for if logic

1 回表示 (過去 30 日間)
Jeevan Patil
Jeevan Patil 2012 年 1 月 3 日
if (Proportional_valve == 2);
Prr_1UL = min(Mod_P_cutoff,Pr);
Prr_1L(i) = min(Mod_P_cutoff,Pr);
elseif (Proportional_valve == 1)
if Pr > Kppo;
Prr_1UL = Kppo + ((PLCRV_UL-Kppo)*Pr/(PLCRV_max-Kppi));
Prr_1L = Kppo + ((PLCRV_L-Kppo)*Pr/(PLCRV_max-Kppi));
else
Prr_1UL = min(Mod_P_cutoff,Pr);
Prr_1L = min(Mod_P_cutoff,Pr);
end
end
in above loop if Proportional_valve == 1 and if Pr>Kppo then program is not using the formula mention in the program if statement is true
Prr_1UL = Kppo + ((PLCRV_UL-Kppo)*Pr/(PLCRV_max-Kppi));
Prr_1L = Kppo + ((PLCRV_L-Kppo)*Pr/(PLCRV_max-Kppi));
it is always clculating the pressure by using
Prr_1UL = min(Mod_P_cutoff,Pr);
Prr_1L = min(Mod_P_cutoff,Pr);
I am giving Pr as a input array. Rest of the parameter are constant
Can anybody help me why this logic is not working..
Regards
Jeevan Patil

採用された回答

TAB
TAB 2012 年 1 月 3 日
What is constant Kppo, array or scalar?
If you are passing Pr as array (not scalar), then comparison of all element must be true to make condition true.

その他の回答 (2 件)

Andrew Newell
Andrew Newell 2012 年 1 月 3 日
You mention that Pr is an array. If you use
if Pr > Kppo
then all the elements of Pr must be greater than Kppo for the statement to be true. You need
if Pr(i) > Kppo

Jeevan Patil
Jeevan Patil 2012 年 1 月 19 日
Thanks Tabrez, Andrew Newell, it is working fine now

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by