how to define the range with variable

조회 수: 3 (최근 30일)
hai xia
hai xia 2022년 6월 1일
댓글: hai xia 2022년 6월 1일
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.

채택된 답변

KSSV
KSSV 2022년 6월 1일
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
hai xia
hai xia 2022년 6월 1일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Torsten
Torsten 2022년 6월 1일
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)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by