Asked by Tyler
on 26 Apr 2013

The answer I'm getting is - 775.94006610198792379207269683591 + 890.01055416454391218342305188902*i My answer should be around 515 any suggestions

here's how I was solving, all variables are given except T2

%Set up Variable T2 = final Temperature for Isentropic process syms T2 %s2 = s(T) of equation 9 %Utilize Matlab solve for Variable T2 Tfinal=solve(s2-s0 == a.*log(T2 ./T0)+b.*(T2 -T0)+.5*c.*(T2.^2-T0^2)+d.*(T2.^3-T0^3)/3+.25*e.*(T2.^4-T0^4),T2)

*No products are associated with this question.*

Related Content

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today
## 6 Comments

## bym (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/73730-not-getting-the-right-root-when-using-solve#comment_145788

what are a,b,c,d,e & To ?

## Babak (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/73730-not-getting-the-right-root-when-using-solve#comment_145789

You need to write the whole code with all the parameters. -755+890i is an answer too.

## Tyler (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/73730-not-getting-the-right-root-when-using-solve#comment_145790

Inputs: TA=400 P1 =20 P2=50

function [ ] = Isentropic( TA, P1, P2 )

%This Mfile finds the final temperature of an isentropic process for Air

% Intial Temp and Initial / Final pressures are given

prompt='What Gas Are We Dealing With?(Type 1 for Air or 2 for Oxygen)';

result=input(prompt);

if result == 1

T0=300; %K

s0=1.70203;%kJ/kg-K

%For Ideal Air %Gas Constant

R=.2869; %kJ/kg K

alpha=3.653;

beta=-1.337*10^-3;

gamma=3.294*10^-6;

delta=-1.913*10^-9;

elpison=0.2763*10^-12;

elseif result == 2 %Oxygen

else error('Please Try Again and Choose Air(1) or Oxygen(2)')

end

%Equation 3

a=alpha*R;

b=beta*R;

c=gamma*R;

d=delta*R;

e=elpison*R;

%Find Specific entropy 1 = s1

s1 = a.*log(TA ./T0)+b.*(TA -T0)+.5*c.*(TA.^2-T0^2)+d.*(TA.^3-T0^3)/3+.25*e.*(TA.^4-T0^4)+s0;

%Find Specific entropy 2 = s2

s2=s1+R.*log(P2./P1);

%Set up Variable T2 = final Temperature for Isentropic process

syms T2

%s2 = s(T) of equation 9

%Utilize Matlab solve for Variable T2

Tfinal=solve(s2-s0 == a.*log(T2 ./T0)+b.*(T2 -T0)+.5*c.*(T2.^2-T0^2)+d.*(T2.^3-T0^3)/3+.25*e.*(T2.^4-T0^4),T2)

end

That's the file, Thanks guys

## Tyler (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/73730-not-getting-the-right-root-when-using-solve#comment_145791

a,b,c,d,e are constants based on experimental data. T0 is the reference property temperature (it is 300K for both gases)

## Tyler (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/73730-not-getting-the-right-root-when-using-solve#comment_145792

Note I get the right answer when using Air

## Zhang lu (view profile)

Direct link to this comment:https://www.mathworks.com/matlabcentral/answers/73730-not-getting-the-right-root-when-using-solve#comment_145799

function [ ] = Isentropic( TA, P1, P2 )

%This Mfile finds the final temperature of an isentropic process for Air

% Intial Temp and Initial / Final pressures are given

prompt='What Gas Are We Dealing With?(Type 1 for Air or 2 for Oxygen)';

result=input(prompt);

if result == 1

T0=300; %K

s0=1.70203;%kJ/kg-K

%For Ideal Air %Gas Constant

R=.2869; %kJ/kg K

alpha=3.653;

beta=-1.337*10^-3;

gamma=3.294*10^-6;

delta=-1.913*10^-9;

elpison=0.2763*10^-12;

elseif result == 2 %Oxygen

end

%Equation 3

a=alpha*R;

b=beta*R;

c=gamma*R;

d=delta*R;

e=elpison*R;

%Find Specific entropy 1 = s1

s1 = a.*log(TA ./T0)+b.*(TA -T0)+.5*c.*(TA.^2-T0^2)+d.*(TA.^3-T0^3)/3+.25*e.*(TA.^4-T0^4)+s0;

%Find Specific entropy 2 = s2

s2=s1+R.*log(P2./P1);

%Set up Variable T2 = final Temperature for Isentropic process

syms T2

%s2 = s(T) of equation 9

%Utilize Matlab solve for Variable T2

Tfinal=solve(a*log(T2 /T0)+b*(T2 -T0)+.5*c*(T2^2-T0^2)+d*(T2^3-T0^3)/3+.25*e*(T2^4-T0^4)-s2+s0,'T2')end

Log in to comment.