%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This program implements an indirect
% adaptive controller based on an E. coli chemotactic
% foraging strategy for the surge tank example.
%
% Kevin Passino
% Version: 9/27/00
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Initialize variables
clear
rand('state',0) % Reset the random number generator so each time you re-
run
% the program with no changes you will get the same
results.
% We assume that the parameters of the tank are:
abar=0.01; % Parameter characterizing tank shape (nominal value is
0.01)
bbar=0.2; % Parameter characterizing tank shape (nominal value is 0.2)
cbar=1; % Clogging factor representing dirty filter in pump
(nominally, 1)
dbar=1; % Related to diameter of output pipe
g=9.8; % Gravity
T=0.1; % Sampling rate
beta0=0.25; % Set known lower bound on betahat
beta1=0.5; % and the upper bound
% Set the length of the simulation (here, also the number of chemotactic
steps)
Nnc=1000;
% As a reference input, we use a square wave (define one extra
% point since at the last time we need the reference value at
% the last time plus one)
timeref=1:Nnc+1;
r(timeref)=3.25-3*square((2*pi/150)*timeref); % A square wave input
%r(timeref)=3.25*ones(1,Nnc+1)-3*(2*rand(1,Nnc+1)-ones(1,Nnc+1)); % A
noise input
ref=r(1:Nnc); % Then, use this one for plotting
time=1:Nnc;
time=T*time; % Next, make the vector real time
% Next, set plant initial conditions
h(1)=1; % Initial liquid level
e(1)=r(1)-h(1); % Initial error
A(1)=abs(abar*h(1)+bbar);
- 1
- 2
- 3
- 4
前往页