how to define the range with variable

h_H2 = 0;
h_O2 = 0;
h_H2O = -241827;
s_H2 = 130.59;
s_O2 = 205.14;
s_H2O = 188.83;
T_ref = 298;
T = 293:1173;
n = 2;
F = 96487;
S = -163.25;
delH = (h_H2O + (143.05-58.04*(T.^0.25)+8.2751*(T.^0.5)-0.036989*T)*(T-T_ref)) - (1/2)*(h_H2 + (56.505-22222.6*(T.^(-0.75))+116500*(T.^(-1))-560700*(T.^(-1.5)))*(T-T_ref)) - (1/2)*(h_O2+(37.432+2.0102*(10.^(-5))*(T.^1.5)-178570*(T.^(-1.5))+2368800*(T.^(-2)))*(T-T_ref));
plot(T,delH)
it works if I use a value for T, but if I want to use the range of the T, it gives me error.

 Réponse acceptée

You need to use elelement by element (.*) multiplication as well .
h_H2 = 0;
h_O2 = 0;
h_H2O = -241827;
s_H2 = 130.59;
s_O2 = 205.14;
s_H2O = 188.83;
T_ref = 298;
T = 293:1173;
n = 2;
F = 96487;
S = -163.25;
delH = (h_H2O + (143.05-58.04*(T.^0.25)+8.2751*(T.^0.5)-0.036989*T).*(T-T_ref)) .....
- (1/2)*(h_H2 + (56.505-22222.6*(T.^(-0.75))+116500*(T.^(-1))-560700.*(T.^(-1.5))).*(T-T_ref)) .....
- (1/2)*(h_O2+(37.432+2.0102*(10.^(-5)).*(T.^1.5)-178570.*(T.^(-1.5))+2368800.*(T.^(-2))).*(T-T_ref));
plot(T,delH)

1 commentaire

hai xia
hai xia le 1 Juin 2022
h_H2 = 0;
h_O2 = 0;
h_H2O = -241827;
s_H2 = 130.59;
s_O2 = 205.14;
s_H2O = 188.83;
T_ref = 298;
T = 293:1173;
n = 2;
F = 96487;
S = -163.25;
CpH2 = 56.505-22222.6*(T.^(-0.75))+116500*(T.^(-1))-560700*(T.^(-1.5));
CpO2 = 37.432+2.0102*(10.^(-5))*(T.^1.5)-178570*(T.^(-1.5))+2368800*(T.^(-2));
CpH2O = 143.05-58.04*(T.^0.25)+8.2751*T.^0.5-0.036989*T;
delH = (h_H2O + CpH2O.*(T-T_ref)) .....
- (1/2)*(h_H2 + CpH2.*(T-T_ref)) .....
- (1/2)*(h_O2 + CpO2.*(T-T_ref));
delS = (s_H2O + CpH2O.*log(T/T_ref)) .....
- (1/2)*(s_H2 + CpH2.*log(T/T_ref)) .....
- (1/2)*(s_O2 + CpO2.*log(T/T_ref));
delG = delH - (T_ref*delS);
Er = -delG/(n*F);
Sr = S/(n*F);
E = Er + Sr*(T - T_ref);
n = delG/delH;
plot(T,E)
So i make it successfully with your help.
One more quesiton, I am trying to get the efficieny n plot with temperature, under the current code, it does not show me a graph of efficiency changing with T.

Connectez-vous pour commenter.

Plus de réponses (1)

Torsten
Torsten le 1 Juin 2022
h_H2 = 0;
h_O2 = 0;
h_H2O = -241827;
s_H2 = 130.59;
s_O2 = 205.14;
s_H2O = 188.83;
T_ref = 298;
T = 293:1173;
n = 2;
F = 96487;
S = -163.25;
delH = (h_H2O + (143.05-58.04*(T.^0.25)+8.2751*(T.^0.5)-0.036989*T).*(T-T_ref)) - (1/2)*(h_H2 + (56.505-22222.6*(T.^(-0.75))+116500*(T.^(-1))-560700*(T.^(-1.5))).*(T-T_ref)) - (1/2)*(h_O2+(37.432+2.0102*(10.^(-5))*(T.^1.5)-178570*(T.^(-1.5))+2368800*(T.^(-2))).*(T-T_ref));
plot(T,delH)

Catégories

En savoir plus sur Vector Fields dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by