Constrainfit: Difference between revisions
Jump to navigation
Jump to search
imported>Scott (New page: ===Purpose=== Purpose of this function. Click '''edit''' at the top of this page to access the source and copy it into your new page. ===Synopsis=== :code here ===Description=== Descr...) |
imported>Rasmus No edit summary |
||
Line 1: | Line 1: | ||
===Purpose=== | ===Purpose=== | ||
Finds A minimizing ||X-A*B'|| subject to constraints, given the small matrices ('''X''' ' '''B''') and ('''B''' ' '''B''') | |||
===Synopsis=== | ===Synopsis=== | ||
: | : [A]=constrainfit(XB,BtB,Aold); % Unconstrained | ||
: opt = constrainfit('options'); | |||
: opt.type='nonnegativity'; | |||
: [A]=constrainfit(XB,BtB,Aold,opt); % Nonnegative | |||
: opt = constrainfit('options'); | |||
: opt.type='columnwise'; | |||
: opt.columnconstraints={0;2;0}; % If three columns | |||
: [A]=constrainfit(XB,BtB,Aold,opt); % Second column unimodal | |||
===Description=== | ===Description=== | ||
CONSTRAINTFIT solves the least squares problem behind bilinear, trilinear and other multilinear models. Assuming a model '''X''' = '''A'''*'''B''' ' and assuming that '''X''' and '''B''' are known, the least squares estimate of '''A''' is obtained. Rather than using '''X''' and '''B''' this algorithm uses the cross product matrices ('''X''' ' '''B''') and ('''B''' ' '''B''') which are generally smaller and less memory-demanding especially in multi-way models. | |||
====Inputs==== | ====Inputs==== |
Revision as of 07:09, 21 October 2008
Purpose
Finds A minimizing ||X-A*B'|| subject to constraints, given the small matrices (X ' B) and (B ' B)
Synopsis
- [A]=constrainfit(XB,BtB,Aold); % Unconstrained
- opt = constrainfit('options');
- opt.type='nonnegativity';
- [A]=constrainfit(XB,BtB,Aold,opt); % Nonnegative
- opt = constrainfit('options');
- opt.type='columnwise';
- opt.columnconstraints={0;2;0}; % If three columns
- [A]=constrainfit(XB,BtB,Aold,opt); % Second column unimodal
Description
CONSTRAINTFIT solves the least squares problem behind bilinear, trilinear and other multilinear models. Assuming a model X = A*B ' and assuming that X and B are known, the least squares estimate of A is obtained. Rather than using X and B this algorithm uses the cross product matrices (X ' B) and (B ' B) which are generally smaller and less memory-demanding especially in multi-way models.
Inputs
- first = first input is this.
Optional Inputs
- second = optional second input is this.
Outputs
- firstout = first output is this.
Options
options = a structure array with the following fields:
- plots: [ {'none'} | 'final' ] governs plotting of results, and
- order: positive integer for polynomial order {default = 1}.
Example
>>This is an example Error: does not exist