I am trying to store all the values of P i get from this loop, but it only returns the last value.
% h k radius
A=[-7.3763 7.6512 7.8 3.5199 1.0563 5.6 5.2646 -4.8721 10.0 2.1783 -0.5596 4.9 -5.4952 2.1826 3.5];[n,m]=size(A);a=1;while a<nfor s=(a+1):n fun=@(x) [(x(1).^2)+(x(2).^2)-2*(x(1)*A(s,1)+x(2)* A(s,2))+(A(s,1)^2)+(A(s,2)^2)-(A(s,3)^2)... (x(1).^2)+(x(2).^2)-2*(x(1)*A(a,1)+x(2)* A(a,2))+(A(a,1)^2)+(A(a,2)^2)-(A(a,3)^2)]; % equation of a circle ((x-h)^2)+((y-k)^2)-r^2=0, (expanded out)
B=[A(a,1),A(a,2)-A(a,3)];%guess
P=fsolve(fun,B)enda=a+1;end
Best Answer