solve non linear equation
Show older comments
I wrote a function to find value of x (with 3 unknown) by solving 3 equations described in F
a= [5 8 4 4];
b= [4 15 3 3];
c= [12 12 2 2];
x0=[0 0 0];
function F = myfun2(x)
F = [sqrt((a(1)-x(1))^2+(a(2)-x(2))^2+(a(3)-x(3))^2)-(a(4)+4);
sqrt((b(1)-x(1))^2+(b(2)-x(2))^2+(b(3)-x(3))^2)-(b(4)+4);
sqrt((c(1)-x(1))^2+(c(2)-x(2))^2+(c(3)-x(3))^2)-(c(4)+4)];
Then I got the error after running this command
x=fsolve(@myfun2,x0)
??? Undefined function or method 'a' for input arguments of type 'double'.
Error in ==> myfun2 at 2
F = [sqrt((a(1)-x(1))^2+(a(2)-x(2))^2+(a(3)-x(3))^2)-(a(4)+4);
Error in ==> fsolve at 254
fuser = feval(funfcn{3},x,varargin{:});
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot
continue.
anyone have any idea that what problem I have? And how to solve it?
Thanks a lot!!!
1 Comment
Walter Roberson
on 9 May 2012
Please reformat your question.
Accepted Answer
More Answers (1)
The Anh
on 13 May 2012
0 votes
Categories
Find more on Eigenvalue Problems 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!