From: Els on
And the x is 7x1 sized;

x =

-51
-8
-35
0
0
0
0
From: Bruno Luong on
"Els " <y.e.t.reeuwijk(a)student.utwente.nl> wrote in message <httdrs$dth$1(a)fred.mathworks.com>...
>
> Is it possible that the error comes from a wrong chosen x0?

Again Els, please use the debugger to chase the error. That is what it's designed for.

Bruno
From: Els on
> Again Els, please use the debugger to chase the error. That is what it's designed for.
>
> Bruno

I'm sorry. But how can i debug when I call this function from another function with fsolve?
From: Bruno Luong on
"Els " <y.e.t.reeuwijk(a)student.utwente.nl> wrote in message <httet1$iv9$1(a)fred.mathworks.com>...
> > Again Els, please use the debugger to chase the error. That is what it's designed for.
> >
> > Bruno
>
> I'm sorry. But how can i debug when I call this function from another function with fsolve?

Set a *breakpoint*: in the m-file editor, click on the left column next to the line number, and until you see a red dot appears, or use F12 key.

Bruno
From: Els on
Changed all the x's in XX's, and I gave in the XX
>> XX =[-51;-8;-35;0;0;0;0]
>> SolveNG(XX)

Then I debugged the function SolveNG, and I get the following error

??? Error using ==> vertcat
CAT arguments dimensions are not consistent.

Error in ==> SolveNG at 27
F = [((XX(1)-cx)/ax)^2 + ((XX(2)-cy)/ay)^2 + ((XX(3)-cz)/az)^2 -1;

-------------
function F = SolveNG(XX)
% F = SolveNG(XX,cx,cy,cz,ax,ay,az,P4,P5,CP)
% XX =[-51;-8;-35;0;0;0;0]
cx = -27.6359;
cy = 15.4697;
cz = -11.3979;
ax = 21.1604;
ay = 21.1604;
az = 21.1604;
P4 = [-35.3578 33.0654 10.1122];
P5 = [ -60.2000 -33.1000 -46.8000];
CP = [-47.8215;11.6973;-6.2917];

n = cross(P4-CP',P4-P5);
n = n(:).'/norm(n)
D1 = -n(1,1)*P4(1,1) - n(1,2)*P4(1,2) - n(1,3)*P4(1,3)

P1=P4(1,1);
P2=P4(1,2);
P3=P4(1,3);
N1=n(1,1)
N2=n(1,2)
N3=n(1,3)

F = [((XX(1)-cx)/ax)^2 + ((XX(2)-cy)/ay)^2 + ((XX(3)-cz)/az)^2 -1;
((2*(XX(1)-cx))/(ax^2))- XX(4);
((2*(XX(2)-cy))/(ay^2))- XX(5);
((2*(XX(3)-cz))/(az^2))- XX(6);
XX(4)*XX(1) + XX(5)*XX(2) + XX(6)*XX(3)+ XX(7);
XX(4)*P1 + XX(5)*P2 + XX(6)*P3+ XX(7);
N1*XX(1) + N2*XX(2) + N3*XX(3) + D1];
end
--------------------