Constrain variable and result range using linfit

Hello, Basically I am fitting a set of data containing 4 variables (matrix X) and result vector Y. When I perform the fitting using nonlinfit I would like to constrain my variables (so each column of X) to a specific range of values, and also my result vector Y. Moreover I would like to impose the fitting factors to be positive.
Example :
X =[ 150 1 5 5 ; 160 2 10 10 ; 170 3 15 15;140 1 10 15]; Y =[1;8;73;68];
modelfun = @(F,X) F(1).*X(:,1) + F(2).*X(:,2) + F(3).*X(:,3) + F(4).*X(:,4) + F(5).*X(:,3).*X(:,4) + F(6); F_fitted = nlinfit(X,Y,modelfun,[1 10 1 1 1 1]);
I would like to constrain X(:,1) to [0:190], and Y(:) to [0:1]. Otherwise I obtain results which do not reflect my experimental reality.
Thanks!

回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

質問済み:

2017 年 9 月 8 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by