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

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

original files for #37

Line 
1function pMix = facchng(pMix, com, Fac)
2% replace predictor factor in a given component
3% pMix = facchng(pMix, com, Fac)
4%
5% pMix : mixture predictor
6% com  : component (number)
7% Fac  : ARX LS factor
8%
9% Design : P. Nedoma
10% Updated: March 2002, July 2004
11% Project: ProDaCTools
12
13ychn = Fac.ychn;
14
15facs = pMix.coms(com,:);               % factors in component
16
17% find channel corresponding to Fac
18for fac = facs
19  if pMix.Facs{fac}.ychn == ychn, break; end
20end
21
22% replace factor in component
23% build states of Fac (pEth)
24STR  = pMix.states.strc;            % big structure
25str1 = 1000*STR(1,:) + STR(2,:);    % encode STR to be vector
26str  = Fac.str;
27str  = 1000*str(1,:) + str(2,:);    % encode factor structure
28len  = length(str);
29pstr = zeros(1, len);
30instr = [];
31for i=1:len
32    j = find(str(i)==str1);
33    if isempty(j),
34       error('target structure does not contain a source element');
35    end
36    instr(i) = j;
37end
38
39%Fac.states.reserved = 'reserved';
40Fac.states.pEth = instr;
41pMix.Facs{fac}  = Fac;
Note: See TracBrowser for help on using the browser.