fsolve function not solving nonlinear equations, I had observed "Invalid datatype. Options argument must be created with OPTIMOPTIONS"; could you assist me, pse
Show older comments
DESCRIPTIO OF TASK
function [FN, Q, y] = mag2(Q0, y0)
ee=0.04; vs=0.00000131; D=[0.220, 0.097, 0.110, 0.220, 0.247, 0.0247, 0.353]; L=[900,400,400,800,500,900,400];
FUN = @(Q,y)[Q(1)-Q(2)-0.03; Q(2)+Q(6)-Q(3)-0.04; Q(3)+Q(4)-0.035; Q(5)-Q(4)-0.01; Q(7)-Q(6)-Q(5)-0.015; ...
1/(y(1)).^0.5+4*log(ee./(3.7*D(1,1))+2.54*3.14*D(1,1)*vs./(4*Q(1)*(y(1)).^0.5)); 1/(y(2)).^0.5+4*log(ee./(3.7*D(1,2))+2.54*3.14*D(1,2)*vs./(4*Q(2)*(y(2)).^0.5));...
1/(y(3)).^0.5+4*log(ee./(3.7*D(1,3))+2.54*3.14*D(1,3)*vs./(4*Q(3)*(y(3)).^0.5)); 1/(y(4)).^0.5+4*log(ee./(3.7*D(1,4))+2.54*3.14*D(1,4)*vs./(4*Q(4)*(y(4)).^0.5));...
1/(y(5)).^0.5+4*log(ee./(3.7*D(1,5))+2.54*3.14*D(1,5)*vs./(4*Q(5)*(y(5)).^0.5)); 1/(y(6)).^0.5+4*log(ee./(3.7*D(1,6))+2.54*3.14*D(1,6)*vs./(4*Q(6)*(y(6)).^0.5));...
1/(y(7)).^0.5+4*log(ee./(3.7*D(1,7))+2.54*3.14*D(1,7)*vs./(4*Q(7)*(y(7)).^0.5));...
Q(1)*abs(y(1)*8*L(1,1)*Q(1)./(9.81*3.14.^2*D(1,1).^5))+Q(2)*abs(y(2)*8*L(1,2)*Q(2)./(9.81*3.14.^2*D(1,2).^5)) ...
-Q(6)*abs(y(6)*8*L(1,6)*Q(6)./(9.81*3.14.^2*D(1,6).^5))+Q(7)*abs(y(7)*8*L(1,7)*Q(7)./(9.81*3.14.^2*D(1,7).^5)); ...
Q(3)*abs(y(3)*8*L(1,3)*Q(3)./(9.81*3.14.^2*D(1,3).^5))-Q(4)*abs(y(4)*8*L(1,4)*Q(4)./(9.81*3.14.^2*D(1,4).^5))...
+Q(6)*abs(y(6)*8*L(1,6)*Q(6)./(9.81*3.14.^2*D(1,6).^5))-Q(5)*abs(y(5)*8*L(1,5)*Q(5)./(9.81*3.14.^2*D(1,5).^5))];
options = optimoptions('fsolve','Display','iter');
[Q,y]=fsolve(FUN,Q0,y0,options);
end
Q0=[-0.15, 0.15]; y0=[0.00001, 0.1]; mag2(Q0, y0)
THE OUTPUT, I GOT
Error using fsolve
Invalid datatype. Options argument must be created with OPTIMOPTIONS.
Error in mag2 (line 15)
[Q,y]=fsolve(FUN,Q0,y0,options);
Accepted Answer
More Answers (0)
Categories
Find more on Linear Least Squares 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!