function x = fltitr(a,b,u,x0,rules) % % FLTITR Linear time invariant time response % % This function is designed to work similarly to the % Matlab internal function LTITR, however, it has % been externalized so that feedback control of the % input may be effected in a non-linear manner without % resorting to ODESIM routines. % % Simulation performs the following: % % x[n+1] = Ax[n] + Bu[n] % % to input sequence U. Matrix U must have as many columns as % there are inputs, u. Each row of U corresponds to a new % time point. FLTITR returns a matrix X with as many columns % as there are outputs y, and with LENGTH(U) rows. % % The string variable rules is the name of a function for % use by FEVAL which will calculate U based on X. For help % construction of this function, see the demo file URUL1.M % % FLTITR(A,B,U,X0) can be used if initial conditions exist. % Here is what it implements: % % for i=1:n % x(:,i) = x0; % x0 = a * x0 + b * RULES(u,x); % end % x = x.'; % Roger McNichols 2/28/95 [n,m] = size(u); for i=1:n, x(:,i) = x0; x0 = a * x0 + b * feval(rules,u(i,:),x0); end x = x.';