Effacer les filtres
Effacer les filtres

Problems with defining a Conditional Formula - Max Y-axis value

1 vue (au cours des 30 derniers jours)
Mark Janssen
Mark Janssen le 18 Déc 2020
Commenté : Walter Roberson le 19 Déc 2020
Hello,
I am looking for a way to solve a formula upto a certain y (P_Cathode) value, what would be the possible ways to go about this?
I was thinking doing using if, else statements but they do not seem to work. At this point I feel lost.
code:
t = [0:1:500];
if P_Cathode >= P_Max_Storage_Pa;
P_Cathode >= P_Max_Storage_Pa; %[Pa]
else
P_Cathode = P_Start_Storage_Pa+((Molair_Mass_Flow_Hours*t)*R*T_Hydrogen_Cathode_K)/(V_storage_m3); %[Pa]
end
Here P_Max_Storage_Pa has a defined value.
Matlab states "Unrecognized function or variable 'P_Cathode'" and I don't know how to solve this, as this is a formula that is solved.

Réponse acceptée

Walter Roberson
Walter Roberson le 18 Déc 2020
P_Cathode = min(P_Max_Storage_Pa, P_Start_Storage_Pa+((Molair_Mass_Flow_Hours*t)*R*T_Hydrogen_Cathode_K)/(V_storage_m3) )
  2 commentaires
Mark Janssen
Mark Janssen le 18 Déc 2020
Modifié(e) : Mark Janssen le 18 Déc 2020
Thanks a lot,
The correct values now appear in the command window, but the workspace still displays it wrongly, how would I get the correct values into the workspace, so I can plot them?
Walter Roberson
Walter Roberson le 19 Déc 2020
That code is an asignment. If the output displayed from it does not match the values stored in the variables, there are a few possibilities:
  • you are using format short which is abbreviating the display in a way that is misleading you about what the values really are. Use format long g instead.
  • your preferences for looking at the workspace are using a format that is misleading you as to what the values really are. The workspace browser has a drop-down that allows you to select a different format, or you can set something in Preferences to give you a better format
  • or perhaps you are looking in the wrong workspace
  • or perhaps you did not arrange to return the P_Cathode calculated here into the right workspace

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur General Applications dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by