i need help in use of f solve

2 views (last 30 days)
Rahul Jangid
Rahul Jangid on 4 Aug 2022
Commented: Torsten on 5 Aug 2022
MY VARIABLES ARE A1 A2 A3 .... A12
code
FF= subs(F-I,{t},{0})
equ = FF-I==0
f = @(A) [FF(1,1);FF(1,2);FF(1,3);FF(1,4);FF(1,5);FF(1,6);FF(1,7);FF(1,8);FF(1,9);FF(1,10);FF(1,11);FF(1,12)];
A0 = [0;0;0;0;0;0;0;0;0;0;0;0];
fsolve(f,A0);
command window
FF =
(A4*sin(A10))/10
(A5*sin(A11))/10
(A6*sin(A12))/10
(10^(1/2)*A1*sin(A7))/100 - 1
(10^(1/2)*A2*sin(A8))/100 - 1
(10^(1/2)*A3*sin(A9))/100
(2^(1/2)*A4*cos(A10))/50
(2^(1/2)*A5*cos(A11))/50
(2^(1/2)*A6*cos(A12))/50
(2^(1/2)*5^(1/2)*10^(1/2)*A1*cos(A7))/1250
(2^(1/2)*5^(1/2)*10^(1/2)*A2*cos(A8))/1250
(2^(1/2)*5^(1/2)*10^(1/2)*A3*cos(A9))/1250
equ =
(A4*sin(A10))/10 == 0
(A5*sin(A11))/10 == 0
(A6*sin(A12))/10 == 0
(10^(1/2)*A1*sin(A7))/100 - 2 == 0
(10^(1/2)*A2*sin(A8))/100 - 2 == 0
(10^(1/2)*A3*sin(A9))/100 == 0
(2^(1/2)*A4*cos(A10))/50 == 0
(2^(1/2)*A5*cos(A11))/50 == 0
(2^(1/2)*A6*cos(A12))/50 == 0
(2^(1/2)*5^(1/2)*10^(1/2)*A1*cos(A7))/1250 == 0
(2^(1/2)*5^(1/2)*10^(1/2)*A2*cos(A8))/1250 == 0
(2^(1/2)*5^(1/2)*10^(1/2)*A3*cos(A9))/1250 == 0
Error using sub2ind
Out of range subscript.
Error in indexing (line 1070)
R_tilde = sub2ind(size(L), Idx.subs{:});
Error in BASICcode>@(A)[FF(1,1);FF(1,2);FF(1,3);FF(1,4);FF(1,5);FF(1,6);FF(1,7);FF(1,8);FF(1,9);FF(1,10);FF(1,11);FF(1,12)] (line 91)
f = @(A) [FF(1,1);FF(1,2);FF(1,3);FF(1,4);FF(1,5);FF(1,6);FF(1,7);FF(1,8);FF(1,9);FF(1,10);FF(1,11);FF(1,12)];
Error in fsolve (line 264)
fuser = feval(funfcn{3},x,varargin{:});
Error in BASICcode (line 93)
fsolve(f,A0);
Caused by:
Failure in initial objective function evaluation. FSOLVE cannot continue.
can someone help me in finding A1 A2 A3....A12
THANKS IN ADVANCE

Answers (1)

Torsten
Torsten on 4 Aug 2022
FF= @(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12)...
[A4*sin(A10)/10;...
A5*sin(A11)/10;...
A6*sin(A12)/10;...
10^(1/2)*A1*sin(A7)/100-1;...
10^(1/2)*A2*sin(A8)/100-1;...
10^(1/2)*A3*sin(A9)/100;...
2^(1/2)*A4*cos(A10)/50;...
2^(1/2)*A5*cos(A11)/50;...
2^(1/2)*A6*cos(A12)/50;...
2^(1/2)*5^(1/2)*10^(1/2)*A1*cos(A7)/1250;...
2^(1/2)*5^(1/2)*10^(1/2)*A2*cos(A8)/1250;...
2^(1/2)*5^(1/2)*10^(1/2)*A3*cos(A9)/1250];
A0 = zeros(12,1);
A=fsolve(@(x)FF(x(1),x(2),x(3),x(4),x(5),x(6),x(7),x(8),x(9),x(10),x(11),x(12)),A0);
No solution found. fsolve stopped because the problem appears regular as measured by the gradient, but the vector of function values is not near zero as measured by the value of the function tolerance.
FF(A(1),A(2),A(3),A(4),A(5),A(6),A(7),A(8),A(9),A(10),A(11),A(12)).'
ans = 1×12
0 0 0 -1 -1 0 0 0 0 0 0 0
A = A.'
A = 1×12
0 0 0 0 0 0 0 0 0 0 0 0
  3 Comments
Torsten
Torsten on 5 Aug 2022
Here is one out of many other solutions:
FF= @(A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12)...
[A4*sin(A10)/10;...
A5*sin(A11)/10;...
A6*sin(A12)/10;...
10^(1/2)*A1*sin(A7)/100-1;...
10^(1/2)*A2*sin(A8)/100-1;...
10^(1/2)*A3*sin(A9)/100;...
2^(1/2)*A4*cos(A10)/50;...
2^(1/2)*A5*cos(A11)/50;...
2^(1/2)*A6*cos(A12)/50;...
2^(1/2)*5^(1/2)*10^(1/2)*A1*cos(A7)/1250;...
2^(1/2)*5^(1/2)*10^(1/2)*A2*cos(A8)/1250;...
2^(1/2)*5^(1/2)*10^(1/2)*A3*cos(A9)/1250];
A0 = [10^1.5;10^1.5;0;0;0;0;pi/2;pi/2;0;0;0;0];
A=fsolve(@(x)FF(x(1),x(2),x(3),x(4),x(5),x(6),x(7),x(8),x(9),x(10),x(11),x(12)),A0);
Equation solved at initial point. fsolve completed because the vector of function values at the initial point is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
FF(A(1),A(2),A(3),A(4),A(5),A(6),A(7),A(8),A(9),A(10),A(11),A(12)).'
ans = 1×12
1.0e-16 * 0 0 0 0 0 0 0 0 0 0.1549 0.1549 0
A = A.'
A = 1×12
31.6228 31.6228 0 0 0 0 1.5708 1.5708 0 0 0 0
Alex Sha
Alex Sha on 5 Aug 2022
There are multi-solutions:
1:
a1: 31.6227766016838
a2: 31.6227766016838
a3: 2.36083264890657E-23
a4: 4.09448676037342E-24
a5: 1.40771653313613E-24
a6: 1.08982226714548E-24
a7: 1.5707963267949
a8: 1.5707963267949
a9: 3.36076391106495
a10: 0.0799370836781829
a11: 0.150749085972828
a12: 2.84134625054234
2:
a1: 31.6227766016838
a2: 31.6227766016838
a3: 9.73775957954368E-24
a4: 9.27177363541737E-25
a5: 6.38358628530267E-24
a6: 2.85107896691379E-25
a7: 1.5707963267949
a8: 1.5707963267949
a9: 0.13671351814447
a10: 4.52655560387454
a11: 0.00590247152841882
a12: 0.0150713428400642
3:
a1: 31.6227766016838
a2: 31.6227766016838
a3: 1.54322372488775E-23
a4: 1.45822660397658E-24
a5: 3.3248029690959E-26
a6: 5.0232448420297E-25
a7: 1.5707963267949
a8: 1.5707963267949
a9: 0.25736060552299
a10: 10.6388443997558
a11: 0.324412616210642
a12: 0.197963203020629

Sign in to comment.

Categories

Find more on Mathematics 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!