function uout = URUL1(u,x) % % URUL1 is a sample rule-base function for fuzzy control % simulation using the command FLSIM (and FLTITR). % The input u is the current value of the input. The % input x is the current state of the system. Note that % since only current values are used and that time itself % is not an available variable, the simulation an still % be said to be "Time-Invariant." In this way, it differs % from simulations like ODESIM. % % URUL1, a sample rule function follows. % Suppose we have a second order system such that x is % a 2-D vector and u is 1-D. uout = u; e1 = u(1)-x(1); e1dot = (x(2)-x(1))/60; if abs(e1) >0 , uout =2*e1; if abs(e1) > .05, uout = 20*e1+30*e1dot; if abs(e1) >.25, uout = 20*e1+40*e1dot; if abs(e1) > .65, uout = 20*e1+ 90*e1dot; end end end end uout = 1;