Not getting proper output for if logic
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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
0 comentarios
Respuesta aceptada
TAB
el 3 de En. de 2012
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.
0 comentarios
Más respuestas (2)
Andrew Newell
el 3 de En. de 2012
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
0 comentarios
Ver también
Categorías
Más información sobre Loops and Conditional Statements en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!