How could I have these two erros when I did everything right (otherwise)?

3 views (last 30 days)
My Code:
clear all
clc
%Initial Given Values
q = 6500; %in kW (kilowatts)
c_p = 1.03; %in kJ/(kg*K)
T_1 = 25; %Temperature of Inlet Air in Celcius
%Initial Guesses
X1 = 1200; %p in kPa
X2 = 400; %w in kg/s
X3 = 75; %E_c in kW
X4 = 100; %t_3 in Celcius
X5 = 50; %E_t in kW
X6 = 125; %t_2 in Celcius
X7 = 100; %E_s in kW
%Solution Vector
X = [X1; X2; X3; X4; X5; X6; X7];
%Jacobian Matrix Initialization
J = zeros(7,7);
%RHS Vector Initialization
F = zeros(7,1);
%First Iteration in the Iteration Process
J = JMat(J,X1,X2,X3,X4,X5,X6,X7);
Unrecognized function or variable 'c_p'.

Error in solution>JMat (line 99)
J(5,2) = c_p*T_1 - c_p*X6;
F = RHS(F,X1,X2,X3,X4,X5,X6,X7);
%Tolerance counter of Initial
I = 0;
%Tolerance
T = 10^(-8); %Larger to Save Time on Processing of Program.
%Error
E = 10^4; %Smaller to decrease time to get final iteration result.
%Additional Iterations
while (E > T)
X_Prev = X;
%Computation of Equation
X = X - Ja\Fa;
%Incremental Increase of Interations
I = I + 1;
%Solutions Get Updated with Each Iteration
X1 = X(1); X2 = X(2); X3 = X(3); X4 = X(4); X5 = X(5); X6 = X(6); X7 = X(7);
%New Jacobian Matrix with each Iteration
J = JMat(Ja,X1,X2,X3,X4,X5,X6,X7);
%New RHS Vector with each Iteration
F = RHS(Fa,X1,X2,X3,X4,X5,X6,X7);
X_New = X;
%Determination of Error
E=find_E(X_Prev, X_New);
end
%Jacobian Matrix Computation
function J = JMat(J,X1,X2,X3,X4,X5,X6,X7)
%First Equation & Differentiations
J(1,1) = 1;
J(1,2) = -20.5 + 5.6*X2;
J(1,3) = 0;
J(1,4) = 0;
J(1,5) = 0;
J(1,6) = 0;
J(1,7) = 0;
J(2,1) = .2 - .004*X1 + 103*exp(-abs(103*X1));
J(2,2) = 0;
J(2,3) = 1;
J(2,4) = 0;
J(2,5) = 0;
J(2,6) = 0;
J(2,7) = 0;
J(3,1) = -.02332 - .96e-4*X1 -.000121*X4 + .5472e-5*X1*X4 + .1137e-6*X2^(2) - .4248*1.995e-08*X1*X4^(2);
J(3,2) = 1;
J(3,3) = .02644 - .3698e-4 -.000121 + .2736e-4*X1^(2) + .2274*X1*X4 - 4248*1.995e-08*X1^(2)*X4;
J(3,4) = 0;
J(3,5) = 0;
J(3,6) = 0;
J(3,7) = 0;
J(4,1) = 10.06 - .066066*X1 -.050921*X4 + 1.705e-4*X1*X4 + .2356e-4*X4^(2) - .8946*3.162e-06*X1*X4^(2);
J(4,2) = 0;
J(4,3) = 0;
J(4,4) = -7.4709 -.0078388*X4 - 0.050921*X1 + .8525E-4*X1^(2) + .4712e-4*X1*X4 - .8946*3.162e-06*X1*X4^(2);
J(4,5) = 1;
J(4,6) = 0;
J(4,7) = 0;
J(5,1) = 0;
J(5,2) = c_p*T_1 - c_p*X6;
J(5,3) = 1;
J(5,4) = 0;
J(5,5) = 0;
J(5,6) = - X2*c_p;
J(5,7) = 0;
J(6,1) = 0;
J(6,2) = -X6*c_p;
J(6,3) = 0;
J(6,4) = X6*c_p;
J(6,5) = 0;
J(6,1) = X4*c_p - X2*c_p;
J(6,7) = 0;
J(7,1) = 0;
J(7,2) = 0;
J(7,3) = -1;
J(7,4) = 0;
J(7,5) = 1;
J(7,6) = 0;
J(7,7) = -1;
end
%Computation of RHS Vector
function F = RHS(Fa,X1,X2,X3,X4,X5,X6,X7)
F1 = X1 - 279 - 20.5*X2 + 2.8*X2^(2);
F2 = X3 - 999 + .2*X1 - .002*X1^(2) - 1.5e-8 - exp(-abs(103*X1));
F3 = X2 - 9.22 - .2342*X1 - .48e-4*X1^(2) + .02644*X4 - .1849e-4*X4^(2) - .000121*X1*X4 + .2736e-4*X1(2)*X4 + .1137e-6*X1*X4^(2) - .2124*1.995e-08*X1^(2)*X4^(2);
F4 = X5 - 1693.2 + 10.06*X1 - .033033*X1^(2) - 7.4709*X4 - .003919*X4^(2) - .050921*X1*X4 + .8525e-4*X1^(2)*X4 + .2356e-4*X1*X4^(2) - .4473*3.162e-06*X1^(2)*X4^(2);
F5 = X3 - X2*c_p + X2*c_p*T_1;
F6 = q -X6*X2*c_p + X6*c_p*X4;
F7 = X5 - X3 - X7;
end
%Error Computations
function E = find_E(X_Prev, X_New)
termA = (X_New - X_Prev)^2;
termA = sum(termA(:))^0.5;
termB = X_New.^2;
termB = sum(termB(:))^0.5;
E = termA/termB;
end

Answers (1)

Torsten
Torsten on 14 Mar 2024
Edited: Torsten on 14 Mar 2024
c_p defined in your script does not mean that it is also visible in your functions.
Either define the functions as nested functions or pass c_p to the functions in which it is needed.
It would work, but you should avoid redefining c_p in the functions or declaring it as a global variable.
This would work, e.g.:
%Initial Given Values
q = 6500; %in kW (kilowatts)
c_p = 1.03; %in kJ/(kg*K)
T_1 = 25; %Temperature of Inlet Air in Celcius
%Initial Guesses
X1 = 1200; %p in kPa
X2 = 400; %w in kg/s
X3 = 75; %E_c in kW
X4 = 100; %t_3 in Celcius
X5 = 50; %E_t in kW
X6 = 125; %t_2 in Celcius
X7 = 100; %E_s in kW
%Solution Vector
X = [X1; X2; X3; X4; X5; X6; X7];
%Jacobian Matrix Initialization
J = zeros(7,7);
%RHS Vector Initialization
F = zeros(7,1);
%First Iteration in the Iteration Process
syms X1s X2s X3s X4s X5s X6s X7s
Fs = RHS(X1s,X2s,X3s,X4s,X5s,X6s,X7s,q,c_p,T_1);
Js = jacobian(Fs);
J = double(subs(Js,[X1s,X2s,X3s,X4s,X5s,X6s,X7s],[X1,X2,X3,X4,X5,X6,X7]));
F = double(subs(Fs,[X1s,X2s,X3s,X4s,X5s,X6s,X7s],[X1,X2,X3,X4,X5,X6,X7]));
%Tolerance counter of Initial
I = 0;
%Tolerance
T = 10^(-8); %Larger to Save Time on Processing of Program.
%Error
E = 10^4; %Smaller to decrease time to get final iteration result.
%Additional Iterations
while (E > T)
X_Prev = X;
%Computation of Equation
X = X - J\F;
%Incremental Increase of Interations
I = I + 1;
%Solutions Get Updated with Each Iteration
X1 = X(1); X2 = X(2); X3 = X(3); X4 = X(4); X5 = X(5); X6 = X(6); X7 = X(7);
J = double(subs(Js,[X1s,X2s,X3s,X4s,X5s,X6s,X7s],[X1,X2,X3,X4,X5,X6,X7]));
F = double(subs(Fs,[X1s,X2s,X3s,X4s,X5s,X6s,X7s],[X1,X2,X3,X4,X5,X6,X7]));
X_New = X;
%Determination of Error
E=norm(X_Prev- X_New)
end
E = 5.5839e+04
E = 3.0211e+05
E = 8.7865e+06
E = 6.1549e+07
E = 1.3673e+08
E = 5.9649e+07
E = 3.6005e+07
E = 7.3927e+08
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.431061e-18.
E = 2.2792e+11
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.544429e-18.
E = 7.7676e+10
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.182247e-19.
E = 8.1774e+10
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.806065e-20.
E = 5.4020e+11
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.847536e-23.
E = 2.0017e+13
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.720376e-23.
E = 5.0481e+13
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.294477e-26.
E = 5.5802e+14
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.940552e-28.
E = 1.8164e+17
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.598853e-38.
E = 2.2978e+22
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.555966e-38.
E = 1.1434e+22
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.470660e-38.
E = 5.7133e+21
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.294937e-38.
E = 2.8492e+21
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.920384e-38.
E = 1.4083e+21
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.088944e-38.
E = 6.6359e+20
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.239809e-38.
E = 1.8630e+20
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.187302e-38.
E = 2.3970e+21
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.179707e-42.
E = 3.3394e+22
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.697763e-41.
E = 4.8627e+22
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.671214e-46.
E = 1.4115e+25
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.835269e-46.
E = 2.9497e+24
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.963784e-47.
E = 3.8068e+25
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.781978e-50.
E = 5.1348e+26
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.096671e-49.
E = 3.4007e+26
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.376846e-52.
E = 1.2181e+28
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.914956e-55.
E = 1.9491e+29
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.616954e-56.
E = 7.4789e+29
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.130135e-59.
E = 1.0344e+32
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.357275e-59.
E = 5.5066e+31
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.774137e-59.
E = 2.4973e+31
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.415812e-59.
E = 1.0218e+31
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.457198e-59.
E = 2.2785e+31
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.501679e-62.
E = 6.5706e+32
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.886917e-62.
E = 8.0761e+33
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.576697e-66.
E = 1.8503e+35
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.391174e-66.
E = 7.7823e+34
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.977270e-67.
E = 7.2164e+33
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.628185e-68.
E = 5.0077e+36
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.161257e-74.
E = 6.1571e+39
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.169031e-74.
E = 3.1235e+39
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.151258e-74.
E = 1.5338e+39
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.474162e-75.
E = 7.0051e+38
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.317012e-73.
E = 8.0794e+38
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.545251e-77.
E = 1.8376e+40
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.030906e-77.
E = 3.4323e+40
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.790643e-80.
E = 8.2254e+41
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.695891e-82.
E = 3.0143e+42
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.967298e-83.
E = 4.2969e+43
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.442082e-87.
E = 2.4048e+45
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.290130e-87.
E = 2.8786e+44
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.606036e-88.
E = 3.1886e+46
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.938609e-93.
E = 3.0157e+48
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.320260e-93.
E = 1.4657e+48
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.036079e-93.
E = 7.9529e+47
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.038850e-94.
E = 1.3676e+50
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.819399e-102.
E = 2.4851e+53
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.906590e-102.
E = 1.2626e+53
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.799938e-102.
E = 6.2831e+52
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.162908e-101.
E = 2.7468e+52
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.061407e-101.
E = 2.4802e+52
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.649146e-102.
E = 1.6591e+53
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.759971e-106.
E = 7.0046e+54
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.332608e-106.
E = 2.9323e+54
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.705075e-107.
E = 4.1606e+54
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.021210e-110.
E = 5.7848e+56
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.747159e-111.
E = 3.1067e+58
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.179495e-118.
E = 5.2097e+61
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.194996e-118.
E = 2.6411e+61
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.183973e-118.
E = 1.3023e+61
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.334433e-119.
E = 6.3484e+60
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.522893e-118.
E = 3.1439e+60
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.244477e-120.
E = 1.5580e+62
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.950448e-123.
E = 1.9287e+63
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.512263e-123.
E = 1.3181e+63
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.155273e-124.
E = 1.8566e+64
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.513057e-128.
E = 1.1768e+66
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.015090e-128.
E = 1.6576e+65
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.319853e-129.
E = 1.1419e+67
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.514972e-134.
E = 6.2067e+68
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.151440e-134.
E = 2.6277e+68
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.069216e-134.
E = 8.6527e+68
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.007056e-140.
E = 4.6591e+72
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.162254e-140.
E = 2.4221e+72
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.446514e-140.
E = 1.1684e+72
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.897992e-140.
E = 5.2848e+71
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.792728e-140.
E = 2.3004e+71
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.361396e-142.
E = 9.0672e+73
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.116978e-149.
E = 3.4701e+77
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.124087e-149.
E = 1.7541e+77
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.130328e-149.
E = 8.7118e+76
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.094715e-149.
E = 4.2528e+76
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.440639e-150.
E = 1.9977e+76
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.016232e-150.
E = 5.8855e+76
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.669404e-153.
E = 1.4704e+78
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.796721e-154.
E = 2.7828e+79
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.763588e-159.
E = 4.1794e+81
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.567560e-159.
E = 2.0805e+81
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.181587e-159.
E = 9.8632e+80
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.271121e-160.
E = 1.1303e+82
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.124632e-164.
E = 4.3767e+83
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.580343e-164.
E = 1.5425e+83
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.707398e-165.
E = 7.7058e+83
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.173460e-168.
E = 4.9295e+85
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.064793e-169.
E = 2.6561e+86
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.573746e-172.
E = 4.1174e+87
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.112815e-171.
E = 1.9477e+87
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.176210e-173.
E = 1.2011e+89
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.231731e-177.
E = 4.2114e+90
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.948677e-178.
E = 1.9894e+90
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.700731e-177.
E = 3.8152e+90
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.170355e-180.
E = 9.5428e+91
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.206915e-180.
E = 1.1454e+93
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.544471e-184.
E = 1.5774e+94
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.291836e-184.
E = 7.1462e+93
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.614030e-184.
E = 1.7376e+93
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.966558e-185.
E = 4.7307e+94
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.503660e-188.
E = 8.5246e+95
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.636065e-188.
E = 3.8645e+95
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.532458e-190.
E = 6.9100e+97
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.530641e-197.
E = 5.8003e+100
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.579861e-197.
E = 2.9420e+100
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.267733e-197.
E = 1.4332e+100
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.897639e-197.
E = 7.0471e+99
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.019706e-197.
E = 1.8895e+100
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.931673e-200.
E = 5.1120e+101
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.684639e-201.
E = 6.8386e+102
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.448591e-205.
E = 5.0858e+104
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.194462e-205.
E = 2.3930e+104
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.235823e-205.
E = 1.8269e+104
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.098497e-206.
E = 9.7183e+105
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.260755e-213.
E = 7.1905e+108
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.336068e-213.
E = 3.4457e+108
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.021478e-213.
E = 1.7041e+108
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.772241e-213.
E = 6.0268e+107
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.615242e-215.
E = 3.1799e+109
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.498180e-216.
E = 6.1406e+109
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.531624e-221.
E = 4.2308e+112
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.550899e-221.
E = 1.4126e+112
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.627405e-221.
E = 1.3941e+112
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.544063e-222.
E = 9.0305e+112
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.496678e-225.
E = 3.0036e+114
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.803039e-226.
E = 1.1673e+115
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.799799e-229.
E = 1.9885e+116
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.943884e-229.
E = 3.1144e+115
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.513144e-233.
E = 1.9466e+118
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.985853e-233.
E = 7.2644e+117
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.451995e-233.
E = 4.3472e+118
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.390362e-237.
E = 2.2890e+120
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.457350e-237.
E = 4.2809e+120
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.033121e-240.
E = 4.2643e+121
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.658780e-241.
E = 6.3021e+122
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.602869e-244.
E = 9.0352e+123
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.829382e-245.
E = 7.0596e+123
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.474979e-243.
E = 7.8439e+122
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.211423e-246.
E = 1.0556e+125
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.918033e-248.
E = 6.9930e+125
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.229815e-249.
E = 2.1242e+126
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.497957e-252.
E = 4.5818e+127
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.333534e-253.
E = 8.0118e+128
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.149850e-258.
E = 1.0079e+131
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.015579e-258.
E = 5.5535e+130
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.725191e-258.
E = 1.9286e+130
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.843690e-258.
E = 1.5561e+131
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.162949e-262.
E = 5.3384e+132
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.562557e-262.
E = 5.7938e+132
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.454548e-263.
E = 2.2506e+133
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.747605e-265.
E = 6.0168e+134
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.170896e-269.
E = 5.5651e+135
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.129117e-267.
E = 4.9411e+135
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.391932e-269.
E = 2.3545e+136
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.415243e-272.
E = 9.3789e+137
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.218941e-273.
E = 6.2065e+137
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.045415e-272.
E = 1.4410e+138
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.164427e-276.
E = 5.8337e+139
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.070482e-276.
E = 1.1588e+139
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.508462e-279.
E = 2.6835e+141
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.098619e-280.
E = 3.7031e+142
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.733076e-285.
E = 2.5348e+144
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.724959e-285.
E = 7.6970e+143
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.412553e-285.
E = 1.9385e+144
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.169844e-286.
E = 7.5065e+144
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.485842e-288.
E = 1.9413e+146
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.147096e-291.
E = 1.4517e+147
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.380332e-289.
E = 1.2519e+147
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.509324e-293.
E = 3.1566e+148
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.507741e-293.
E = 2.1199e+148
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.223807e-297.
E = 1.2336e+150
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.017981e-297.
E = 2.2510e+150
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.751215e-301.
E = 1.2433e+152
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.730818e-301.
E = 3.6719e+152
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 8.062876e-304.
E = 2.7815e+153
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.994664e-304.
E = 6.3869e+153
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 3.979664e-307.
E = 1.5900e+155
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.436190e-308.
E = 2.5854e+156
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.276408e-313.
E = 2.8204e+158
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 5.609554e-313.
E = 1.3904e+158
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.219755e-313.
E = 6.7007e+157
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.079611e-313.
E = 9.3461e+158
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.118120e-319.
E = 1.5802e+162
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.077458e-319.
E = 7.4689e+161
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.700979e-320.
E = 3.5007e+161
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.843303e-320.
E = 8.6699e+160
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.283583e-320.
E = 2.2007e+162
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.940656e-324.
E = 3.7219e+163
Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.482197e-323.
E = 1.7215e+163
Warning: Matrix is singular to working precision.
E = 1.6768e+165
Warning: Matrix is singular to working precision.
E = 2.5047e+167
Warning: Matrix is singular to working precision.
E = 1.2499e+167
Warning: Matrix is singular to working precision.
E = 5.8426e+166
Warning: Matrix is singular to working precision.
E = 5.0648e+167
Warning: Matrix is singular to working precision.
E = 1.6850e+169
Warning: Matrix is singular to working precision.
E = 1.4114e+169
Warning: Matrix is singular to working precision.
E = 4.4847e+169
Warning: Matrix is singular to working precision.
E = 1.1642e+171
Warning: Matrix is singular to working precision.
E = 2.6482e+171
Warning: Matrix is singular to working precision.
E = 8.6890e+172
Warning: Matrix is singular to working precision.
E = 1.7883e+174
Warning: Matrix is singular to working precision.
E = 8.0359e+173
Warning: Matrix is singular to working precision.
E = 2.8613e+175
Warning: Matrix is singular to working precision.
E = 1.7611e+177
Warning: Matrix is singular to working precision.
E = 5.0858e+176
Warning: Matrix is singular to working precision.
E = 1.7270e+177
Warning: Matrix is singular to working precision.
E = 7.5918e+177
Warning: Matrix is singular to working precision.
E = 3.4275e+179
Warning: Matrix is singular to working precision.
E = 2.0838e+181
Warning: Matrix is singular to working precision.
E = 1.0025e+181
Warning: Matrix is singular to working precision.
E = 6.3216e+180
Warning: Matrix is singular to working precision.
E = 2.1948e+182
Warning: Matrix is singular to working precision.
E = 1.1707e+183
Warning: Matrix is singular to working precision.
E = 3.1266e+183
Warning: Matrix is singular to working precision.
E = 7.9970e+184
Warning: Matrix is singular to working precision.
E = 6.4774e+185
Warning: Matrix is singular to working precision.
E = 1.8962e+187
Warning: Matrix is singular to working precision.
E = 8.5936e+186
Warning: Matrix is singular to working precision.
E = 8.3661e+187
Warning: Matrix is singular to working precision.
E = 2.9099e+189
Warning: Matrix is singular to working precision.
E = 1.8578e+189
Warning: Matrix is singular to working precision.
E = 3.9026e+189
Warning: Matrix is singular to working precision.
E = 1.8316e+191
Warning: Matrix is singular to working precision.
E = 1.0121e+191
Warning: Matrix is singular to working precision.
E = 1.1350e+193
Warning: Matrix is singular to working precision.
E = 2.6482e+194
Warning: Matrix is singular to working precision.
E = 6.2852e+196
Warning: Matrix is singular to working precision.
E = 3.1630e+196
Warning: Matrix is singular to working precision.
E = 1.4865e+196
Warning: Matrix is singular to working precision.
E = 1.9913e+196
Warning: Matrix is singular to working precision.
E = 4.8230e+197
Warning: Matrix is singular to working precision.
E = 7.6732e+197
Warning: Matrix is singular to working precision.
E = 4.4701e+199
Warning: Matrix is singular to working precision.
E = 1.6655e+200
Warning: Matrix is singular to working precision.
E = 1.6112e+201
Warning: Matrix is singular to working precision.
E = 1.4065e+201
Warning: Matrix is singular to working precision.
E = 3.5364e+202
Warning: Matrix is singular to working precision.
E = 2.0462e+202
Warning: Matrix is singular to working precision.
E = 1.4203e+204
Warning: Matrix is singular to working precision.
E = 4.4043e+204
Warning: Matrix is singular to working precision.
E = 2.1673e+206
Warning: Matrix is singular to working precision.
E = 2.4687e+206
Warning: Matrix is singular to working precision.
E = 9.7405e+206
Warning: Matrix is singular to working precision.
E = 2.6213e+208
Warning: Matrix is singular to working precision.
E = 2.4046e+209
Warning: Matrix is singular to working precision.
E = 1.4601e+209
Warning: Matrix is singular to working precision.
E = 4.3979e+210
Warning: Matrix is singular to working precision.
E = 1.3821e+211
Warning: Matrix is singular to working precision.
E = 1.8479e+212
Warning: Matrix is singular to working precision.
E = 2.8345e+215
Warning: Matrix is singular to working precision.
E = 1.3459e+215
Warning: Matrix is singular to working precision.
E = 6.3684e+214
Warning: Matrix is singular to working precision.
E = 1.8937e+214
Warning: Matrix is singular to working precision.
E = 2.0789e+215
Warning: Matrix is singular to working precision.
E = 1.7255e+216
Warning: Matrix is singular to working precision.
E = 2.5509e+216
Warning: Matrix is singular to working precision.
E = 6.0886e+217
Warning: Matrix is singular to working precision.
E = 8.9740e+218
Warning: Matrix is singular to working precision.
E = 6.0463e+220
Warning: Matrix is singular to working precision.
E = 2.0380e+220
Warning: Matrix is singular to working precision.
E = 2.4105e+220
Warning: Matrix is singular to working precision.
E = 4.2742e+220
Warning: Matrix is singular to working precision.
E = 2.5586e+222
Warning: Matrix is singular to working precision.
E = 5.1653e+222
Warning: Matrix is singular to working precision.
E = 2.7593e+224
Warning: Matrix is singular to working precision.
E = 6.8517e+224
Warning: Matrix is singular to working precision.
E = 4.4404e+225
Warning: Matrix is singular to working precision.
E = 2.8924e+226
Warning: Matrix is singular to working precision.
E = 9.9166e+227
Warning: Matrix is singular to working precision.
E = 6.9556e+227
Warning: Matrix is singular to working precision.
E = 1.7729e+228
Warning: Matrix is singular to working precision.
E = 6.2334e+229
Warning: Matrix is singular to working precision.
E = 4.9073e+229
Warning: Matrix is singular to working precision.
E = 2.3644e+231
Warning: Matrix is singular to working precision.
E = 1.6319e+231
Warning: Matrix is singular to working precision.
E = 1.5490e+233
Warning: Matrix is singular to working precision.
E = 2.3988e+234
Warning: Matrix is singular to working precision.
E = 2.3668e+236
Warning: Matrix is singular to working precision.
E = 1.1620e+236
Warning: Matrix is singular to working precision.
E = 5.7289e+235
Warning: Matrix is singular to working precision.
E = 1.4998e+238
Warning: Matrix is singular to working precision.
E = 3.7624e+241
Warning: Matrix is singular to working precision.
E = 1.9046e+241
Warning: Matrix is singular to working precision.
E = 9.4306e+240
Warning: Matrix is singular to working precision.
E = 4.5583e+240
Warning: Matrix is singular to working precision.
E = 2.1656e+240
Warning: Matrix is singular to working precision.
E = 9.8554e+241
Warning: Matrix is singular to working precision.
E = 4.6173e+243
Warning: Matrix is singular to working precision.
E = 1.8363e+243
Warning: Matrix is singular to working precision.
E = 6.7390e+241
Warning: Matrix is singular to working precision.
E = 2.9048e+244
Warning: Matrix is singular to working precision.
E = 2.7492e+244
Warning: Matrix is singular to working precision.
E = 1.9863e+243
Warning: Matrix is singular to working precision.
E = 7.2568e+242
Warning: Matrix is singular to working precision.
E = 2.2604e+243
Warning: Matrix is singular to working precision.
E = 9.5876e+243
Warning: Matrix is singular to working precision.
E = 3.4096e+245
Warning: Matrix is singular to working precision.
E = 9.3537e+246
Warning: Matrix is singular to working precision.
E = 4.2625e+246
Warning: Matrix is singular to working precision.
E = 2.7887e+247
Warning: Matrix is singular to working precision.
E = 8.3780e+248
Warning: Matrix is singular to working precision.
E = 1.3326e+249
Warning: Matrix is singular to working precision.
E = 6.3316e+249
Warning: Matrix is singular to working precision.
E = 8.9531e+251
Warning: Matrix is singular to working precision.
E = 1.5645e+255
Warning: Matrix is singular to working precision.
E = 7.9288e+254
Warning: Matrix is singular to working precision.
E = 3.9117e+254
Warning: Matrix is singular to working precision.
E = 1.8700e+254
Warning: Matrix is singular to working precision.
E = 1.0114e+254
Warning: Matrix is singular to working precision.
E = 5.4158e+255
Warning: Matrix is singular to working precision.
E = 1.2365e+257
Warning: Matrix is singular to working precision.
E = 5.5760e+256
Warning: Matrix is singular to working precision.
E = 1.0643e+258
Warning: Matrix is singular to working precision.
E = 5.0560e+259
Warning: Matrix is singular to working precision.
E = 9.3774e+257
Warning: Matrix is singular to working precision.
E = 1.5658e+261
Warning: Matrix is singular to working precision.
E = 4.1838e+264
Warning: Matrix is singular to working precision.
E = 2.0380e+264
Warning: Matrix is singular to working precision.
E = 1.0025e+264
Warning: Matrix is singular to working precision.
E = 4.5748e+263
Warning: Matrix is singular to working precision.
E = 3.7949e+262
Warning: Matrix is singular to working precision.
E = 4.3348e+265
Warning: Matrix is singular to working precision.
E = 1.2741e+269
Warning: Matrix is singular to working precision.
E = 6.4470e+268
Warning: Matrix is singular to working precision.
E = 3.1958e+268
Warning: Matrix is singular to working precision.
E = 1.5504e+268
Warning: Matrix is singular to working precision.
E = 7.2752e+267
Warning: Matrix is singular to working precision.
E = 1.4234e+269
Warning: Matrix is singular to working precision.
E = 6.8426e+270
Warning: Matrix is singular to working precision.
E = 2.2368e+269
Warning: Matrix is singular to working precision.
E = 9.6570e+272
Warning: Matrix is singular to working precision.
E = 2.4503e+277
Warning: Matrix is singular to working precision.
E = 1.2170e+277
Warning: Matrix is singular to working precision.
E = 6.0767e+276
Warning: Matrix is singular to working precision.
E = 3.0205e+276
Warning: Matrix is singular to working precision.
E = 1.4685e+276
Warning: Matrix is singular to working precision.
E = 6.1077e+275
Warning: Matrix is singular to working precision.
E = 4.8914e+275
Warning: Matrix is singular to working precision.
E = 6.5645e+275
Warning: Matrix is singular to working precision.
E = 9.5434e+277
Warning: Matrix is singular to working precision.
E = 4.5622e+279
Warning: Matrix is singular to working precision.
E = 5.7207e+282
Warning: Matrix is singular to working precision.
E = 2.9016e+282
Warning: Matrix is singular to working precision.
E = 1.4247e+282
Warning: Matrix is singular to working precision.
E = 6.7271e+281
Warning: Matrix is singular to working precision.
E = 6.0973e+281
Warning: Matrix is singular to working precision.
E = 1.6123e+283
Warning: Matrix is singular to working precision.
E = 2.5604e+283
Warning: Matrix is singular to working precision.
E = 6.2663e+284
Warning: Matrix is singular to working precision.
E = 1.9163e+285
Warning: Matrix is singular to working precision.
E = 1.5529e+287
Warning: Matrix is singular to working precision.
E = 5.3758e+290
Warning: Matrix is singular to working precision.
E = 2.6282e+290
Warning: Matrix is singular to working precision.
E = 1.2978e+290
Warning: Matrix is singular to working precision.
E = 6.0734e+289
Warning: Matrix is singular to working precision.
E = 1.4523e+289
Warning: Matrix is singular to working precision.
E = 4.2607e+290
Warning: Matrix is singular to working precision.
E = 8.3155e+291
Warning: Matrix is singular to working precision.
E = 3.7573e+291
Warning: Matrix is singular to working precision.
E = 7.6334e+293
Warning: Matrix is singular to working precision.
E = 4.5380e+297
Warning: Matrix is singular to working precision.
E = 2.2335e+297
Warning: Matrix is singular to working precision.
E = 1.1093e+297
Warning: Matrix is singular to working precision.
E = 5.3715e+296
Warning: Matrix is singular to working precision.
E = 2.1514e+296
Warning: Matrix is singular to working precision.
E = 2.8519e+296
Warning: Matrix is singular to working precision.
E = 6.5118e+296
Warning: Matrix is singular to working precision.
E = 2.7010e+298
Warning: Matrix is singular to working precision.
E = 1.7218e+297
Warning: Matrix is singular to working precision.
E = 1.3060e+300
Warning: Matrix is singular to working precision.
E = 1.9556e+301
Warning: Matrix is singular to working precision.
E = 8.4673e+302
Warning: Matrix is singular to working precision.
E = 3.4786e+302
Warning: Matrix is singular to working precision.
E = 2.9727e+301
Warning: Matrix is singular to working precision.
E = 3.0105e+304
Warning: Matrix is singular to working precision.
E = NaN
%Computation of RHS Vector
function F = RHS(X1,X2,X3,X4,X5,X6,X7,q,c_p,T_1)
F1 = X1 - 279 - 20.5*X2 + 2.8*X2^(2);
F2 = X3 - 999 + .2*X1 - .002*X1^(2) - 1.5e-8 - exp(-abs(103*X1));
F3 = X2 - 9.22 - .2342*X1 - .48e-4*X1^(2) + .02644*X4 - .1849e-4*X4^(2) - .000121*X1*X4 + .2736e-4*X1^(2)*X4 + .1137e-6*X1*X4^(2) - .2124*1.995e-08*X1^(2)*X4^(2);
F4 = X5 - 1693.2 + 10.06*X1 - .033033*X1^(2) - 7.4709*X4 - .003919*X4^(2) - .050921*X1*X4 + .8525e-4*X1^(2)*X4 + .2356e-4*X1*X4^(2) - .4473*3.162e-06*X1^(2)*X4^(2);
F5 = X3 - X2*c_p + X2*c_p*T_1;
F6 = q -X6*X2*c_p + X6*c_p*X4;
F7 = X5 - X3 - X7;
F = [F1;F2;F3;F4;F5;F6;F7];
end
  1 Comment
Torsten
Torsten on 15 Mar 2024
The professional MATLAB solver doesn't succeed, either, with your set of equations:
%Initial Given Values
q = 6500; %in kW (kilowatts)
c_p = 1.03; %in kJ/(kg*K)
T_1 = 25; %Temperature of Inlet Air in Celcius
%Initial Guesses
X0 = zeros(7,1);
X0(1) = 1200; %p in kPa
X0(2) = 400; %w in kg/s
X0(3) = 75; %E_c in kW
X0(4) = 100; %t_3 in Celcius
X0(5) = 50; %E_t in kW
X0(6) = 125; %t_2 in Celcius
X0(7) = 100; %E_s in kW
norm(RHS(X0(1),X0(2),X0(3),X0(4),X0(5),X0(6),X0(7),q,c_p,T_1))
ans = 4.4506e+05
options = optimset('MaxFunEvals',5000000,'MaxIter',5000000);
sol_X = fsolve(@(x)RHS(x(1),x(2),x(3),x(4),x(5),x(6),x(7),q,c_p,T_1),X0,options)
Solver stopped prematurely. fsolve stopped because it exceeded the function evaluation limit, options.MaxFunctionEvaluations = 5.000000e+06.
sol_X = 7×1
1.0e+03 * -0.0343 -0.0094 0.6204 -0.9298 2.3711 0.0069 1.7513
norm(RHS(sol_X(1),sol_X(2),sol_X(3),sol_X(4),sol_X(5),sol_X(6),sol_X(7),q,c_p,T_1))
ans = 570.6358
%Computation of RHS Vector
function F = RHS(X1,X2,X3,X4,X5,X6,X7,q,c_p,T_1)
F1 = X1 - 279 - 20.5*X2 + 2.8*X2^(2);
F2 = X3 - 999 + .2*X1 - .002*X1^(2) - 1.5e-8 - exp(-abs(103*X1));
F3 = X2 - 9.22 - .2342*X1 - .48e-4*X1^(2) + .02644*X4 - .1849e-4*X4^(2) - .000121*X1*X4 + .2736e-4*X1^(2)*X4 + .1137e-6*X1*X4^(2) - .2124*1.995e-08*X1^(2)*X4^(2);
F4 = X5 - 1693.2 + 10.06*X1 - .033033*X1^(2) - 7.4709*X4 - .003919*X4^(2) - .050921*X1*X4 + .8525e-4*X1^(2)*X4 + .2356e-4*X1*X4^(2) - .4473*3.162e-06*X1^(2)*X4^(2);
F5 = X3 - X2*c_p + X2*c_p*T_1;
F6 = q -X6*X2*c_p + X6*c_p*X4;
F7 = X5 - X3 - X7;
F = [F1;F2;F3;F4;F5;F6;F7];
end

Sign in to comment.

Categories

Find more on Test and Measurement in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!