nlcontrol

Stephen vanHook (view profile)

Nonlinear algorithm for controlling dynamical systems, particularly where linear methods fail.

y=bridsim(u)
```function y=bridsim(u)
%Simulation of the liquid bridge
%4-dimensional weakly nonlinear system with two inputs and two outputs.
%Nonlinearities are present in the state transition matrix as saturating x^3
%terms and as the term corresponding to the crossmixing of the inputs (u1*u2)
% V. Petrov 6-10-97, CNLD
% e-mail: Val.Petrov@chaos.ph.utexas.edu
%
% Copyright (c) 1997, 1998 The University of Texas at Austin

pert_delay=1; %Perturbation propagation delay. Adjustable between 0 and 2

global Ksi resp;

if(length(Ksi)==0) %Initialize internal coordinates
Ksi=ones(4,1);
Ksi(3:4)=-Ksi(3:4);
resp=0*ones(3,2);
end

% Define state transition matices (A-linear, B,C-nonlinear)
I=sqrt(-1);
A = diag([ 0.05-I*0.8 0.05+I*0.8 0.05+I*0.8 0.05-I*0.8]);

% The coefficient 0.03 here defines the nonlinearity of the system.
% Try to increase it and see how control degrades due to
% the poorer approximation. Collect more data points
% to restore the convergence.

B=-0.1*diag([ 1+I*0.1 1.0-I*0.1 1+I*0.1 1.0-I*0.1]);

% Cross-coupling matrix
C=0.1*[0 0 0 1; 0 0 1 0; 0 1 0 0; 1 0 0 0];

%Fixed point shift vector for two perturbations
G1=[0.2 0.2 0.1 0.1];
G2=[0.4 0.4 -0.3 -0.3];
%Nonlinear crossmixing of inputs
G3=[0.01 0.01 -0.02 -0.02];

ro=[1,1,0.5,0.5];
Ksif0=[0.1;0.1;0.1;0.1];

% Simulate the delay of the perturbation here
resp(3,:)=resp(2,:);
resp(2,:)=resp(1,:);
resp(1,:)=u'+1e-5*randn(1,2);

%Perturbation causes linear shift of the fixed point
Ksif=Ksif0 + G1'.*resp(1+pert_delay,1) + G2'.*resp(1+pert_delay,2)...
+ G3'.*resp(1+pert_delay,1)*resp(1+pert_delay,2);

%Simulation of continius system: 50 time steps per one sampling iteration
%Nonlinearity comes only as a simple 2nd order diagonal term
for i = 1:50
Ksi=Ksi + 0.03*(Ksif + (A+B*diag(abs(Ksi-Ksif))^2+C*diag(Ksi-Ksif))*(Ksi-Ksif));
end

y(1)=ro*Ksi+1e-5*randn;
y(2)=[1+I 1-I 1 1]*Ksi+1e-5*randn;
y=y';
```