MATLAB: I have more non-linear equations than unknowns. How to solve it in matlab? One method I know is non-linear least squares, how can I implement it in Matlab or you just suggest me anything you deem more proper.

solve

x1=475060;y1=1096300;z1=4670;x2=481500;y2=1094900;z2=4694;x3=482230;y3=1088430;z3=4831;x4=478050;y4=1087810;z4=4775;
% ((x-x1)^2)+((y-y1)^2)+((z-z1)^2)=5942.607^2 % ((x-x2)^2)+((y-y2)^2)+((z-z2)^2)=2426.635^2 % ((x-x3)^2)+((y-y3)^2)+((z-z3)^2)=5094.254^2 % ((x-x4)^2)+((y-y4)^2)+((z-z4)^2)=5549.874^2
%4 equations
%x y z unknowns

Best Answer

Aside from FSOLVE, you can try LSQNONLIN which is another least squares solver. However, I obtain nearly the same results (x,y,z) for your problem with both FSOLVE and LSQNONLIN.
F=@(x,y,z)[((x-x1)^2)+((y-y1)^2)+((z-z1)^2)-5942.607^2
((x-x2)^2)+((y-y2)^2)+((z-z2)^2)-2426.635^2;
((x-x3)^2)+((y-y3)^2)+((z-z3)^2)-5094.254^2;
((x-x4)^2)+((y-y4)^2)+((z-z4)^2)-5549.874^2
]
fun=@(u) F(u(1),u(2),u(3));
x0=mean([x1 y1 z1;x2 y2 z2; x3 y3 z3; x4 y4 z4])
[u1,fval1]=fsolve(fun,x0),
[u2,~,fval2]=lsqnonlin(fun,x0)
>> norm(u1-u2)
ans =
9.7868e-04