Overview
Comment: | Saved (quite old) version which integrates IR to give SR |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | origin/master | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e67a236326010ab178cd4951ffceaac0 |
User & Date: | gawthrop@users.sourceforge.net on 1996-12-05 10:18:52 |
Other Links: | branch diff | manifest | tags |
Context
1996-12-05
| ||
10:38:36 |
Decided that integrating the IR is a bad idea. So now explicitly computes the SR using matrix exponential -- much more accurate. check-in: 5fd8598766 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
10:18:52 | Saved (quite old) version which integrates IR to give SR check-in: e67a236326 user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
10:17:34 | Put in version control history. check-in: 532092897f user: gawthrop@users.sourceforge.net tags: origin/master, trunk | |
Changes
Modified mttroot/mtt/bin/trans/m/sm2sr.m from [3cfd117635] to [aedb773097].
1 2 | function [Y,X] = sm2sr(A,B,C,D,T,u0,x0); % [Y,X] = sm2sr(A,B,C,D,T,u0,x0); | > > > > > > > < > > > | 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 | function [Y,X] = sm2sr(A,B,C,D,T,u0,x0); % sm2sr - Constrained-state matrix to step response. % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %%%%% Model Transformation Tools %%%%% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Matlab function sm2sr % [Y,X] = sm2sr(A,B,C,D,T,u0,x0); % A,B,C,D,E - (constrained) state matrices % T vector of time points % u0 input gain vector: u = u0*unit step. % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% Version control history % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % %% $Id$ % %% $Log$ % %% Revision 1.3 1996/10/27 10:39:04 peterg % %% Only compute matrix exponential once. % %% % %% Revision 1.2 1996/09/10 16:48:21 peter % %% Changed ar counts in default settings. % %% % %% Revision 1.1 1996/08/19 15:34:29 peter % %% Initial revision % %% % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
︙ | ︙ | |||
35 36 37 38 39 40 41 | if M>N T = T'; N = M; end; | | | | | | | | | | | | | | | | | | | | | | | | | | > > > > > > > > > > > | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | if M>N T = T'; N = M; end; % $$$ one = eye(Nx); % $$$ % $$$ Y = zeros(N,Ny); % $$$ X = zeros(N,Nx); % $$$ % $$$ dt = T(2)-T(1);% Assumes fixed interval % $$$ expAdt = expm(A*dt); % Compute matrix exponential % $$$ i = 0; % $$$ expAt = one; % $$$ % $$$ for t = T' % $$$ i=i+1; % $$$ if Nx>0 % $$$ x = ( A\(expAt-one) )*B*u0 + expAt*x0; % $$$ expAt = expAt+expAdt; % $$$ X(i,:) = x'; % $$$ if Ny>0 % $$$ y = C*x + D*u0; % $$$ Y(i,:) = y'; % $$$ end; % $$$ elseif Ny>0 % $$$ y = D*u0; % $$$ Y(i,:) = y'; % $$$ end; % $$$ end; % Compute the impulse response [Y,X] = sm2ir(A,B,C,D,T,u0,x0); % Assume fixed sample interval dT = T(2)-T(1); % Do an Euler integration on it Y = mtt_euler(Y,dT); if nargout>1 X = mtt_euler(X,dT); end; |