please tell the solution
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Atif Irshad
le 14 Juil 2020
Réponse apportée : Star Strider
le 14 Juil 2020
function h_t=t_enthalpy(T)
%%%% Vector containing the total enthalpy of each species at a specified
%%%% temperature
T_ref=298.15;
h_t=zeros(11,1);
%%% Order of the components [bms, water, char, o2, n2, steam,
%%% co2, h2, co, ch4, tars]
%Cp of the gases: [O2, N2, steam, CO2, H2, CO, CH4, tars]
%Form of the eq: Cp=A+Bt+Ct^2+Dt^3+E/t^2; t=T/1000
%Gases in this cp matrix and formation enthalpy vector: O2, N2, steam, CO2,
%H2, CO, CH4]
t=T/1000;
Cp=(29.659+6.137261*t-1.186521*t^2+0.095780*t^3-0.219663*t^-2+26.092+8.218801*t-1.976141*t^2+0.159274*t^3+0.044434*t^-2+30.092+6.832514*t+6.793435*t^2-2.53448*t^3+0*0.082139*t^-2+24.99735+55.18696*t-33.69137*t^2+7.948387*t^3-0.136638*t^-2+33.066178-11.363417*t+11.432816*t^2-2.772874*t^3-0.158558*t^-2+25.56759+6.096130*t+4.054656*t^2-2.671301*t^3+0.131021*t^-2-0.703029+108.4773*t-42.52157*t^2+5.862788*t^3+0.678565*t^-2); %[j/mol k]
hf=1000*[0; 0; -241.83; -393.51; 0; -110.53; -74.87]; %[j/mol]
%%% Calculation of the enthalpy for the gaseous components
t_ref=T_ref/1000;
h_t(1:10)=hf+(1000*(Cp(:,1)*(t-t_ref)+Cp(:,2)*((t^2-t_ref^2)/2)+Cp(:,3)*((t^3-t_ref^3)/3)+Cp(:,4)*((t^4-t_ref^4)/4)+Cp(:,5)*(1/t_ref-1/t)));
%%% Calculation for the biomass
w_bms=23.5020; %[g/mol]
h_t(1)=-89854.0977+(w_bms/1000)*(3.86*(T^2-T_ref^2)/2+103.1*(T-T_ref));
%%% Calculation for water
h_t(2)=-285800+(18/1000)*4180*(T-T_ref);
%%% Calculation for char
h_t(3)=0+(12/1000)*(0.36*(T^2-T_ref^2)/2+1390*(T-T_ref));
%%% Calculation for tars
h_t(11)=1000*82.927+(88.627*(T-T_ref)+0.12074*(T^2-T_ref^2)/2-0.12735e-4*(T^3-T_ref^3)/3-0.36688e7*(1/T_ref-1/T));
end
%% In this code it is showing "Index in position 2 exceeds array bounds (must not exceed 1)".
0 commentaires
Réponse acceptée
Star Strider
le 14 Juil 2020
If ‘T’ is a scalar, note that ‘Cp’ is also a scalar, so by definition it is a (1x1) array. Referring to it with any dimension greater than 1 in any dimension will throw a similar error.
If ‘T’ is a vector, the problem becomes one of requiring element-wise operations in the ‘Cp’ calculation (and perhaps others).
0 commentaires
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Quantum Mechanics dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!