I am having the following set of 4 non linrear equations with 6 variable x1,x2,x3,x4,x5,x6
2*x2*(15*10^-3)-x3-x4-x5=x1=0
Initial guess is x1=603,x2=5*10^4,x3=9.5*10^-6,x4=0,x5=1374,x6=1373
For the equations to solve I have used the following code :
x0 = [603 5*10^4 9.5*10^-6 0 1374 1373]
F = @(x) [x(1)-(5*10^3*x(2))-353;
0.03*x(2)-(2*x(2)*x(3))-(2*x(2)*x(4))-(2*x(2)*x(5))+(2*x(2)*(x1));
8.2*x(6)+x(4)*x(2)-1259];
x0 = [603 5*(10^4) 9.5*(10^-6) 0 1374 1373];
options = optimoptions('fsolve','Display','iter');
[x,fval] = fsolve(F,x0,options)
error is unrecognised x1...............
Further I want a loop to be incorporated:
This equations has to ve solved iteratively for (x4)i+1= (x4)i+2.2*10^-6*(delta T) where T = [0.1:1:20]
I am interested to store and plot x1,x2,x3,x4,x5,x6 vs T
Any help will be very much appreciated.... I tried to intiate the solution with fsolve ... but I am not in position to call functions, execute the for loop and store the iteration results for plotting.
Thanking you in advance !
3 Comments
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/723738-fsolve-with-loop-and-to-store-variable#comment_1278148
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/723738-fsolve-with-loop-and-to-store-variable#comment_1278148
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/723738-fsolve-with-loop-and-to-store-variable#comment_1278213
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/723738-fsolve-with-loop-and-to-store-variable#comment_1278213
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/723738-fsolve-with-loop-and-to-store-variable#comment_1278218
Direct link to this comment
https://ch.mathworks.com/matlabcentral/answers/723738-fsolve-with-loop-and-to-store-variable#comment_1278218
Sign in to comment.