Info
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
Nonlinear solutions with 7 variables my initial Guess is not working in the program
조회 수: 2 (최근 30일)
이전 댓글 표시
syms G;
G = 600:100:1200;
disp(G)
x0 = [310 310 310 311 309 300 300];%initial guess
options = optimoptions('fsolve','Display','off');
X = zeros(1,length(G)); % use X, instead of X(i), initialize with zeros
for i = 1:length(G) % start the loop counter from 1
fsol = fsolve(@(x) solutionsproblem(x,G(i)),x0,options);
X(i,:) = fsol; end
Tg1 = x(:,1); Tg2 = x(:,2); Ta = x(:,3); Tl = x(:,4); Tf = x(:,5); Tb = x(:,6); Th = x(:,7);
disp(X);
function F = solutionsproblem(x,G)
syms N;
syms A;
%assign values to constants
N = 15;
A = 1;
Tg1 = 300;
Tg2 = 301.5;
Ta = 305.8;
Tl = 302;
Tf = 302;
Tb = 302;
Th = 300;
F(1) = 0.0425*G + 1.417*10^(-8)*x(2)^(4) + 0.95*x(2) - 1.967*10^(-8)*x(1)^(4) + 1098.572 - 2404.5*x(1) + 2400*Tg1;
F(2) = 0.0204*G + (-4.888*10^(-8) - 7.709*10^(-11)*N*A)*x(2)^(4) + 1.41*10^(-8)*x(1)^(4) + 4.54*10^(-10)* x(4)^(4) + 3.08*10^(-8)*x(3)^(4) + 7.709*10^(-11)*N*A*x(5)^(4) + 0.55*x(3) + 0.95*x(1) - 2401.5*x(2) - 2400*Tg2;
F(3) = 0.124*G - 6.098*10^(-8)*x(3)^(4) + 3.049*10^(-8)*x(2)^(4) + 3.049*10^(-8)*x(5)^(4)- 568.69*x(3) + 0.236*x(6) + 1.183* x(2) + 567.9*Ta;
F(4) = 4.06*10^(-3)*G - 90.37*10^(-10)*x(4)^(4) + 9.88*10^(-10)*x(7)^(4)+ 9.88*10^(-10)*x(2)^(4) + 0.08*x(7) + 0.044*x(3) + 0.044*x(2) - 132.687*x(4) + 132.44*Tl;
F(5) = 3.686*10^(-4)*N*A*G + 3.049*10^(-8)*x(3)^(4) + 7.7*10^(-11)*x(2)^(4) - 3.056*10^(-8)*x(5)^(4) + 3.88*10^(-4)*N*x(6) + 3.52*10^(-3)*N*A*(x(3) + x(2)) - (3.88*10^(-4)*N + 7.04*10^(-3)*N*A + 215)*x(5) - 215*Tf;
F(6) = 0.386*x(3) + 0.18362*x(7) + 3.88*10^(-4)*N*x(5) + 0.1*x(2) - (194.269 + 3.88*10^(-4)*N)*x(5) + 193.6*Tb;
F(7)= 0.08*x(4) + 9.88*10^(-10)*(x(4)^(4) - x(7)^(4)) + 0.0706*x(6) - 838.79*x(7) + 838.22*Th;
end
댓글 수: 0
답변 (0개)
이 질문은 마감되었습니다.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!