Part 2-- Vectorized function.

function out=f(theta)
%indirectly provides solution to forward kinematics problem of the 2D
%planar Stewart platform


%knowns: platform side lengths
L_1=2;
L_2=sqrt(2);
L_3=L_2;


%knowns: strut lengths
p_1=sqrt(5);
p_2=p_1;
p_3=p_1;


%knowns: important coordinates of struts
%(x,y) [platform coonnection], (x_1,0) [end], (x_2,y_2) [end]
x=1;
y=2;

x_1=4;

x_2=0;
y_2=4;


%knowns: angle inside platform, across from L_1
gamma=pi*(1/2);


%equation definitions from 1.38
A_2=L_3*cos(theta)-x_1;
B_2=L_3*sin(theta);
A_3=L_2*cos(theta+gamma)-x_2;
B_3=L_2*sin(theta+gamma)-y_2;


%D as the denominator in 1.39
D=2*(A_2.*B_3-B_2.*A_3);


%N_1 and N_2 as shown in 1.39
N_1=B_3.*(p_2.^2-p_1.^2-A_2.^2-B_2.^2)-B_2.*(p_3.^2-p_1.^2-A_3.^2-B_3.^2);
N_2=-1*A_3.*(p_2.^2-p_1.^2-A_2.^2-B_2.^2)+A_2.*(p_3.^2-p_1.^2-A_3.^2-B_3.^2);


%solution is shown as 1.40
out=N_1.^2+N_2.^2-p_1.^2*D.^2;
Not enough input arguments.

Error in f_2 (line 35)
A_2=L_3*cos(theta)-x_1;