root/library/utia_legacy/ticket_37/facarxls.m @ 567

Revision 567, 1.3 kB (checked in by smidl, 15 years ago)

original files for #37

Line 
1function Sim = facarxls(ychn, str, default)
2% build ARX LS factor
3% Fac = facarxls(ychn, str,default)
4% Fac = facarxls(ychn, str) default = 'A'
5%   
6% Fac     : ARX LS factor    type = 2
7% ychn    : output channel
8% str     : factor structure
9% default : string determining type of default values to be used, see defaults.m
10%
11% Design  : P. Nedoma
12% Updated : 9.3.00
13% Project : ProDaCTools
14% See also: facarx, comarx, comarxls, defaults
15%
16% Reference:
17% Updated  : June 02, MK
18
19%%%%%%%% begin patch MK
20% test of arguments
21  if nargin<2
22     error(' use: Fac = facarxls(ychn, str, default) ');
23  end
24  if ~isempty(str)
25     if size(str,1)~=2
26        error('invalid structure: two rows are expected');
27     end
28     if any( str(:)<0)
29        error('invalid structure: time delays must be non-negative');
30     end
31  end
32  if ychn<1
33     error('invalid output channel: it has to be natural number');
34  end
35% test end
36%%%%%%%%  end of patch MK
37   if nargin<3, default = 'A'; end
38   [dia,cove,dfm]=defaults(default); % defaults
39   npsi  = size(str,2);              % length of regression vector
40   Eth  = zeros(1,npsi);             % LS parameter estimates
41   Cth  = eye(npsi,npsi)*dia;        % "covariance" of Eth
42
43   Sim = struct('ychn',ychn,'str',str,'dfm', dfm, 'type', 2, ...
44            'cove',cove, 'Eth',Eth,'Cth',Cth);
Note: See TracBrowser for help on using the browser.