MATLAB: Solve 12 equations with 12 unknown ERROR: FSOLVE requires all values returned by functions to be of data type double.

equationfsolvesystem

Given the following equations in the script
function F = root12d(x)
F(1) = x(1)-x(3) == 0;
F(2) = -x(5)+x(6) == 0;
F(3) = x(7)+x(9)-4 == 0;
F(4) = x(11)+x(12)-4 == 0;
F(5) = sqrt((x(1)-x(4))^2+(x(2)-x(5))^2+(x(3)-x(6))^2)-2 == 0;
F(6) = sqrt((x(4)-x(7))^2+(x(5)-x(8))^2+(x(5)-x(9))^2)-2 == 0;
F(7) = sqrt((x(7)-x(10))^2+(x(8)-x(11))^2+(x(9)-x(12))^2)-2 == 0;
F(8) = sqrt((x(10)-x(1))^2+(x(11)-x(2))^2+(x(12)-x(3))^2)-2 == 0;
F(9)= ( (x(4)-x(1))*(x(10)-x(1))+(x(5)-x(2))*(x(11)-x(2))+(x(6)-x(3))*(x(12)-x(3)) ) / ((sqrt((x(4))-x(1))^2+(x(5)-x(2))^2+(x(6)-x(3))^2)*sqrt((x(10)-x(1))^2+(x(10)-x(2))^2+(x(12)-x(3))^2)) -cosd(90) == 0;
F(10)= ( (x(1)-x(4))*(x(7)-x(4))+(x(2)-x(5))*(x(8)-x(5))+(x(3)-x(6))*(x(9)-x(6)) ) / ((sqrt((x(1))-x(4))^2+(x(2)-x(5))^2+(x(3)-x(6))^2)*sqrt((x(7)-x(4))^2+(x(8)-x(5))^2+(x(9)-x(6))^2)) -cosd(90) == 0;
F(11)= ( (x(4)-x(7))*(x(12)-x(7))+(x(5)-x(8))*(x(11)-x(8))+(x(6)-x(9))*(x(12)-x(9)) ) / ((sqrt((x(4))-x(7))^2+(x(5)-x(8))^2+(x(6)-x(9))^2)*sqrt((x(10)-x(7))^2+(x(11)-x(8))^2+(x(12)-x(9))^2)) -cosd(90) == 0;
F(12)= ( (x(7)-x(10))*(x(1)-x(10))+(x(8)-x(11))*(x(2)-x(11))+(x(9)-x(12))*(x(3)-x(12)) ) / ((sqrt((x(7))-x(10))^2+(x(8)-x(11))^2+(x(9)-x(12))^2)*sqrt((x(1)-x(10))^2+(x(2)-x(11))^2+(x(3)-x(12))^2)) -cosd(90) == 0;
when applying
fun = @root12d;
x0 = [0,0,0,0,0,0,0,0,0,0,0,0];
x = fsolve(fun,x0)
The error message as written in title occur. How can i change the values returned by the Functions into double?

Best Answer

Remove all the "== 0" strings.
Best wishes
Torsten.
Related Question