Download IN-PARALLEL PASSIVE COMPLIANT COUPLER FOR ROBOT
Transcript
50
{
double coef[37], dis, X, Y, Z[37], X0, XX[40],YY[40],
U, V, dUx, dUy, den , dX, dY, dXY, XY, C, B[40] ;
int i, k, deg, cnt ;
int lst, lflip, ltry ;
if (d > 36)
return (0) ;
for (i=0 ; i<=d ; ++i)
coef[i] = xcof[i] ;
deg = d ;
while (coef[deg] == 0.0)
deg-- ; /*The leading coefficient was zero.*/
if (deg <1)
return (-1) ;
cnt = 0 ;
/*The polynomial must be at least of degree 1.*/
/*cnt keeps track of the number of roots found */
if (deg == 1)
goto solve_linear ;
if (deg == 2)
goto solve_quad ;
/**************************/
/* Set initial values.
*/
/**************************/
L30:
lst = 0 ;
/*lst counts the number of different starting values*/
lflip = 0 ; /*lflip determines whether the inverse polynomial is
being considered */
X = 0.00608 ;
Y = 0.2939 ;
L35:
X0 = X ;
X = -5.0*Y ;
Y = 2.0*X0 ;
ltry = 0 ;
/*ltry counts the # of interations for a starting value*/
lst++ ;
L38:
XX[0] = 1.0 ;
YY[0] = 0.0 ;
for (i=1 ; i<=deg ; ++i)
/*Evaluate x^16, x^15, etc where x is complex*/
{XX[i] = X * XX[i-1] - Y * YY[i-1] ;
YY[i] = X * YY[i-1] + Y * XX[i-1] ;
/*line 40*/
}
U = coef[0] ;
V = 0.0 ;