Overview
Comment:Added step gain (u0) and initial condition (x0)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | origin/master | trunk
Files: files | file ages | folders
SHA3-256: f13510619dd82e79a0753872db83dba6e814706ba4bc33e7730d4666224f6165
User & Date: gawthrop@users.sourceforge.net on 1996-08-15 08:34:08
Other Links: branch diff | manifest | tags
Context
1996-08-15
08:50:20
Initial revision check-in: 427dc1df35 user: gawthrop@users.sourceforge.net tags: origin/master, trunk
08:34:08
Added step gain (u0) and initial condition (x0) check-in: f13510619d user: gawthrop@users.sourceforge.net tags: origin/master, trunk
07:44:24
Now handles generic transformations using %. check-in: fdb0d576da user: gawthrop@users.sourceforge.net tags: origin/master, trunk
Changes

Modified mttroot/mtt/bin/trans/m/dm2sr.m from [11bd2fd927] to [3a20b68940].

1
2
3
4
5
6
7
8
9
10
11
12



13
14
15
16
17
18
19
20











21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38

39
40
41
function sr = dm2sr(A,B,C,D,E,T);
% sr = dm2sr(A,B,C,D,E,T);
% Descriptor matrix to impulse response.
% NB At the moment - this assumes that E is unity .....
% A,B,C,D,E - descriptor matrices
% T vector of time points

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$



% %% Revision 1.2  1996/08/11 10:37:40  peter
% %% Corrected mistake in step-response calculation.
% %%
% %% Revision 1.1  1996/08/11 09:42:40  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%













[N,M] = size(T);
if M>N
  T = T';
  N = M;
end;

[Ny,Nu] = size(D);
NN=Ny*Nu;

[N_y,N_x] = size(C);
one = eye(N_x);

sr = zeros(N,NN);
i = 0;
for t = T'
  i=i+1;
  SR = C*( A\(expm(A*t)-one) )*B + D;

  sr(i,:) = reshape(SR, 1,NN);
end;

|











>
>
>








>
>
>
>
>
>
>
>
>
>
>







<
<
<
<
|

|



|
>
|


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41




42
43
44
45
46
47
48
49
50
51
52
function sr = dm2sr(A,B,C,D,E,T,u0,x0);
% sr = dm2sr(A,B,C,D,E,T);
% Descriptor matrix to impulse response.
% NB At the moment - this assumes that E is unity .....
% A,B,C,D,E - descriptor matrices
% T vector of time points

% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% Version control history
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %% $Id$
% %% $Log$
% %% Revision 1.3  1996/08/11 19:33:24  peter
% %% Replaced exp by expm - whoops!
% %%
% %% Revision 1.2  1996/08/11 10:37:40  peter
% %% Corrected mistake in step-response calculation.
% %%
% %% Revision 1.1  1996/08/11 09:42:40  peter
% %% Initial revision
% %%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[Ny,Nu] = size(D);
[Ny,Nx] = size(C);

if nargin<7
  u0 = zeros(Nu,1);
  u0(1) = 1;
end;

if nargin<8
  x0 = zeros(Nx,1);
end;

[N,M] = size(T);
if M>N
  T = T';
  N = M;
end;





one = eye(Nx);

sr = zeros(N,Ny);
i = 0;
for t = T'
  i=i+1;
  expAt = expm(A*t);
  SR = C*( ( A\(expAt-one) )*B*u0 + expAt*x0) + D*u0;
  sr(i,:) =SR';
end;


MTT: Model Transformation Tools
GitHub | SourceHut | Sourceforge | Fossil RSS ]