% normsteer.m - normalized steering dynamics % RMM, 13 Feb 07 % % This file contains a model for a steering control system, as % described in Astrom and Murray, Example 5.12. % % The model has been set up to allow feedback control via a % gain-scheduled controller. To use the file in this way, you should % define controller gains K1, K2 and K3 as globals in the script that % calls this file and set them to the proper values. You will also need % to modify the code here to properly compute the scheduled gain from % the parameters of the system. function dxdt = normsteer(t, x) global K1 K2 K3; % include controller gains % Compute the vehicle speed parameter alpha = 2 + 2*sin(t/50 * 2*pi); % Compute the reference position yref = square(t/20 * 2*pi); % Figure out the gain to use (replace with your gain schedule) K = [1 1]; % Now compute the control law u = -K * (x - [yref; 0]); % And finally, compute the dynamics dxdt = [0 1; 0 0] * x + [alpha; 1] * u;