27 lines
398 B
Matlab
27 lines
398 B
Matlab
|
#Friction multiplied
|
||
|
function xo = sgn( x=[x1; x2; x3])
|
||
|
xo = [0;0;0;];
|
||
|
if x(1) > 0 ;
|
||
|
xo(1) = 1;
|
||
|
elseif x(1) < 0;
|
||
|
xo(1) = -1;
|
||
|
else;
|
||
|
%% xo(1) = x(1);
|
||
|
endif;
|
||
|
if x(2) > 0 ;
|
||
|
xo(2) = 1;
|
||
|
elseif x(2) < 0;
|
||
|
xo(2) = -1;
|
||
|
else;
|
||
|
%% xo(2) = x(2);
|
||
|
endif;
|
||
|
if x(3) > 0 ;
|
||
|
xo(3) = 1;
|
||
|
elseif x(3) < 0;
|
||
|
xo(3) = -1;
|
||
|
else;
|
||
|
%% xo(3) = x(3);
|
||
|
endif;
|
||
|
endfunction
|
||
|
|