Error using sub2ind - Out of range subscript.

I want to simplify the equation mcphayphayvtzto that contains the symbolic variable tz.
disp('The combustion process')
disp('The mean molar specific heat of combustion products')
M2(1,1)= 0.4958;
MCO2(1,1)= 0.0512;
MCO(1,1)=0.0201;
MH20(1,1)=0.0625;
MH2(1,1)=0.0100;
MN2(1,1)=0.3520;
M2(1,3201)=0.5367;
MCO2(1,3201)=0.0655;
MCO(1,3201)=0.0057;
MH20(1,3201)=0.0696;
MH2(1,3201)=0.0029;
MN2(1,3201)=0.3930;
disp('Dua vào Formulae to determine mean molar heat capacities of certain gases at constant volume, kJ/(kmole deg), at tz (do C)')
disp('mcphayphayvtzto=(1/M2)*[MCO2*(39.123+0.003349*tz)+MCO*(22.490+0.001430*tz)+MH20*(26.670+0.004438*tz)+MH2*(19.678+0.001758*tz)+MN2*(21.951+0.001457*tz)]')
syms tz
disp('At n = 800 rpm')
mcphayphayvtzto(1,1)=(1/M2(1,1))*[MCO2(1,1)*(39.123+0.003349*tz(1,1))+MCO(1,1)*(22.490+0.001430*tz(1,1))+MH20(1,1)*(26.670+0.004438*tz(1,1))+MH2(1,1)*(19.678+0.001758*tz(1,1))+MN2(1,1)*(21.951+0.001457*tz(1,1))];
pretty(mcphayphayvtzto(1,1))
disp('At n = 4000, 6000, 7000 rpm')
mcphayphayvtzto(1,3201)=(1/M2(1,3201))*[MCO2(1,3201)*(39.123+0.003349*tz(1,3201))+MCO(1,3201)*(22.490+0.001430*tz(1,3201))+MH20(1,3201)*(26.670+0.004438*tz(1,3201))+MH2(1,3201)*(19.678+0.001758*tz(1,3201))+MN2(1,3201)*(21.951+0.001457*tz(1,3201))];
pretty(mcphayphayvtzto(1,3201))

3 个评论

The problem is:
tz(1,3201)
because tz is a (1x1) symbolic variable.
thanks, i created new syms variable called tz3201.

请先登录,再进行评论。

回答(0 个)

类别

产品

标签

Community Treasure Hunt

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

Start Hunting!

Translated by