Part 4-- Full function.

function out=f_4(theta)
%indirectly provides solution to forward kinematics problem of the 2D
%planar Stewart platform (with parameters given by Part 4)


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


%knowns: strut lengths
p_1=5;
p_2=p_1;
p_3=3;


%knowns: important coordinates of struts
%(x,y) [platform coonnection], (x_1,0) [end], (x_2,y_2) [end]
%x= UNKNOWN-- must solve for this!
%y= UNKNOWN-- must solve for this!

x_1=5;

x_2=0;
y_2=6;


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


%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_4 (line 35)
A_2=L_3*cos(theta)-x_1;