I don't know how to make this equation work! please. Matlab

86 views Asked by At

I'm trying to calculate the adiabatic flame temperature. I have this script, I'm trying to get a value of T out, how do I make it work? Or is there a better way of doing it?

HRxn=((4*-393.5)+(5*-241.83)-(-124.73))*1000; %dH reaction
C=(240.2*298)+(1.51*298^2)-(9.2e-5*298^3)+(1.25e-8*298^4);%298 evaluated

X=(240.2*T)+(1.51*T.^2)-(9.2e-5*T.^3)+(1.25e-8*T.^4);
S=solve(HRxn+(X-C)==0,T)

Thanks!

3

There are 3 answers

0
GDD On

i think you should give more information of what you want to do,

HRxn=((4*-393.5)+(5*-241.83)-(-124.73))*1000; %dH reaction
C=(240.2*298)+(1.51*298^2)-(9.2e-5*298^3)+(1.25e-8*298^4);%298 evaluated

X=(240.2*T)+(1.51*T.^2)-(9.2e-5*T.^3)+(1.25e-8*T.^4);
S=solve(HRxn+(X-C)==0,T)

first and second lines are const. i do not see a point of the equations.

HRxn = -2658420
C = 2.033375664162000e+05

So what you want to do is

F(T)=-2658420+(240.2*T)+(1.51*T.^2)-(9.2e-5*T.^3)+(1.25e-*T.^4)-.033375664162000e+05; %this is HRxn+(X-C) syms T; S=solve(F,T); For me it does not make sense, you have just one variable "T". What do you want to do with solve.

F(T) =(944473296573929*T^4)/75557863725914323419136 - (6788401819125115*T^3)/73786976294838206464 + (151*T^2)/100 + (1201*T)/5 - 98329241254705015/34359738368

That is what you get.

Unless you are looking for the Roots of the equiation. Then you need the coeff. of F(T).

p=[-8 -5 1.51 240.2 -2.861800000091987e+06 ]; %coeff from T^4...T^0
r = roots(p);
r =-17.4518 +17.3032i
   -17.4518 -17.3032i
    17.1393 +17.2782i
    17.1393 -17.2782i

I hope this is what you need, i could have made mistakes with the numbers, but i think you get the idea.

0
Rody Oldenhuis On

So, basically, you want to solve a quartic polynomial? Then just use roots:

HRxn         = 1e3 * ((4*-393.5) + (5*-241.83) + 124.73);
coefficients = [1.25e-8  -9.2e-5  1.51  240.2];
constant     = HRxn - coefficients * 298.^(4:-1:1).';
quartic      = [coefficients  constant];

R = roots(quartic);
flame_temperature = R(imag(R)==0 & R > 0);
2
marcoresk On

Add

syms T

before your lines of code, because you didn't defined it before. Then your solution are made visible by

disp(S)