Revision 706, 1.0 kB
(checked in by smidl, 15 years ago)
|
eol-native
|
-
Property svn:eol-style set to
native
|
Rev | Line | |
---|
[567] | 1 | function 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 | |
---|
| 13 | ychn = Fac.ychn; |
---|
| 14 | |
---|
| 15 | facs = pMix.coms(com,:); % factors in component |
---|
| 16 | |
---|
| 17 | % find channel corresponding to Fac |
---|
| 18 | for fac = facs |
---|
| 19 | if pMix.Facs{fac}.ychn == ychn, break; end |
---|
| 20 | end |
---|
| 21 | |
---|
| 22 | % replace factor in component |
---|
| 23 | % build states of Fac (pEth) |
---|
| 24 | STR = pMix.states.strc; % big structure |
---|
| 25 | str1 = 1000*STR(1,:) + STR(2,:); % encode STR to be vector |
---|
| 26 | str = Fac.str; |
---|
| 27 | str = 1000*str(1,:) + str(2,:); % encode factor structure |
---|
| 28 | len = length(str); |
---|
| 29 | pstr = zeros(1, len); |
---|
| 30 | instr = []; |
---|
| 31 | for 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; |
---|
| 37 | end |
---|
| 38 | |
---|
| 39 | %Fac.states.reserved = 'reserved'; |
---|
| 40 | Fac.states.pEth = instr; |
---|
| 41 | pMix.Facs{fac} = Fac; |
---|