%  FARC1f_update.M
%
%	Calculate adapation rate 
% (needs 'farc1.mdl' 'farc1_fuzzifier.m', 'af_input_gen.m')

function rate = farc1f_update(x)

% x(1)~x(12) : Xi    x(13) = sigma   x(14)~x(25) : theta    
rate = zeros(12,1);
r = 5000;				%adatpation gain(learning rate)
theta_lb = -200;
theta_ub =  200;

for i = 1:12;
   alpha = r*x(13)*x(i);
   rate(i)= alpha*(((x(i+13)>theta_lb)|(alpha>0))&((x(i+13)<theta_ub)|(alpha<0)));
end;