Non lenier equations in loop

G = 600:100:1200; x0=[300;300;300;300;300;300;300]; options=optimset('Display','off'); X(i) = NaN(1,length(G)); for i = 600:length(G) fsol = fsolve(@(x)solutionsproblem(x,G(i)),x0,options);
X(i) = fsol(1); end
function F =solutionsproblem(x,G) Tg1 = 300; Tg2 = 301.5; Ta = 305.8; Tl = 302; Tf = 302; Tb = 302; Th = 300; F(1) = 0.0425*G + 1.41*10^(-8)*x(2)^(4) + 1.34*x(2) - 9.12*10^(-9)*x(1)^(4) + 341 - 2402.77*x(1) + 2400*Tg1; F(2) = 0.0204*G - (3.48*10^(-8) + 4.35*10^(-10)*1)*x(2)^(4) + 1.41*10^(-8)*x(1)^(4) + 8.01*10^(-11)* x(4)^(4) + 2.43*10^(-8)*x(3)^(4) + 4.35*10^(-10)*1*x(5)^(4) + 0.55*x(3) + 1.34*x(1) - 2401.87*x(2) + 2400*Tg2; F(3) = 0.124*G - 4.88*10^(-8)*x(3)^(4) + 2.44*10^(-8)*1*x(2)^(4) + 2.44*10^(-8)*1*x(5)^(4)- 50.938*x(3) + 11.502*x(6) + 1.836* x(2) + 37.60*Ta; F(4) = 0.011*G - 8.70*10^(-8)*x(5)^(4) + 4.35*10^(-10)*x(3)^(4)+ 4.35*10^(-10)*x(2)^(4) + 0.83*x(6) + 0.112*x(3) + 0.112*x(2) - (1.055 + (112.7/1))*x(5) + (112.7/1)*Tf; F(5) = 2.17*10^(-3)*G - 1.6*10^(-10)*x(4)^(4) + 8.01*10^(-11)*x(7)^(4) + 8.01*10^(-11)*x(2)^(4) - 69.07*x(4) + 3.77*10^(-4)*x(7) + 0.02*x(3) + 0.02*x(2) + 69*Tl; F(6) = -52.068*x(6) + 0.412*x(3) + 0.368*x(4)+ 0.368*x(5) + 0.46*x(2) + 50.78*Tb; F(7)= 3.77*10^(-4)*x(4) + 8.01*10^(-11)*x(4)^(4) + 0.092*x(5) - 1254.1*x(7) - 8.01*10^(-11)*x(7)^(4) + 1254*Th; end

6 Comments

What is your question? Does the code as written have a problem? Does it do what you wanted? If not, then what does it do (or not do)?
The question is unclear for me. Can you be more specific?
Can you format your code? It's hard to read
Using this button
I am getting eror on the 4th line And I don't know what to do
what kind of error? Can you be more specific?

Answers (0)

This question is closed.

Asked:

on 7 Apr 2020

Closed:

on 20 Aug 2021

Community Treasure Hunt

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

Start Hunting!