Download System Identification Toolbox User`s Guide

Transcript
3
Tutorial
larger). When the model structure contains parameters with different orders of
magnitude, try to scale the variables so that the parameters are all roughly the
same magnitude. In any case, you may need to edit the M-file nuderst to
address the problem of suitable step sizes for numerical differentiation.
Some Examples of User-Defined Model Structures
With user-defined structures, you have complete freedom in the choice of
models of linear systems. This section gives two examples of such structures.
Example 6.3: Heat Diffusion. Consider a system driven by the heat-diffusion
equation (see also Example 4.3 in Ljung (1987)).
This is a metal rod with heat-diffusion coefficient κ which is insulated at the
near end and heated by the power u (W) at the far end. The output of the
system is the temperature at the near end. This system is described by a partial
differential equation in time and space. Replacing the space-second derivative
by a corresponding difference approximation gives a time-continuous
state-space model (6.9), where the dimension of x depends on the step-size in
space used in the approximation. This is described by the following M-file:
function [A,B,C,D,K,x0] = heatd(pars,T,aux)
N = aux(1); % Number of points in the
% space–discretization
L = aux(2); % Length of the rod
temp = aux(3); % Assuming uniform initial
% temperature of the rod
deltaL = L/N; % Space interval
kappa = pars(1); % The heat–diffusion coefficient
K = pars(2); % Heat transfer coefficient at
% far end of rod
F=zeros(N,N);
for kk=2:N–1
F(kk,kk–1)=1;
F(kk,kk)=–2;
F(kk,kk+1)=1;
end
F(1,1)=–1; F(1,2)=1; % Near end of rod
% insulated
F(N,N–1)=1; F(N,N)=–1;
F=F∗kappa/deltaL/deltaL;
3-38