User`s guide
Estimating Linear Grey- Box Models
The following M-file describes the state-space equation for this model. In
this case, the auxiliary v ariables specify grid-size variables, so that you can
modifythegridsizewithouttheM-file.
function [A,B, C,D, K,x0] = heatd(pars,T,aux)
% Number of points in the space-discretization
Ngrid = aux(1);
% Length of the rod
L = aux(2);
% Initial rod temperature (un iform)
temp = aux(3);
% Space interval
deltaL = L/Ngrid;
% Heat-diffusio n coefficient
kappa = pars(1);
% Heat transfer coefficient at far end of rod
htf = pars(2);
A = zeros(Ngrid,Ngrid);
for kk = 2 :Ngr id-1
A(kk,kk-1) = 1;
A(kk,kk) = -2;
A(kk,kk+1) = 1;
end
% Boundary condition on insulated end
A(1,1) = -1; A(1,2) = 1;
A(Ngrid,Ngrid-1) = 1;
A(Ngrid,Ngrid) = -1;
A = A*kappa/deltaL/deltaL;
B = zeros(Ngrid,1);
B(Ngrid,1) = htf/deltaL;
C = zeros(1,Ngrid);
C(1,1) = 1;
D=0;
K = zeros(Ngrid,1);
x0 = temp*ones(Ngrid,1);
5-11