How do I fit a piecewise continuous function?

3 ビュー (過去 30 日間)
Amore
Amore 2013 年 9 月 6 日
The following function is defined:
if true
% f = @(c, x_bsn) (c(1).*x_bsn.^(c(2))).*and(x_bsn>=bound2,x_bsn<=bound1)) + (c(3)-c(4).*x_bsn.^(c(5))).*(and(x_bsn>=bound3,x_bsn<bound2));
end
Where c(1)-c(5) are the coefficients that need to be determined, x_bsn is the variable and the boundaries are specified by bound1 - bound3.
Then a fit is done using:
if true
%fit = lsqcurvefit(f,c0,x,y);
end
Where x and y are the dataset.
The problem is that the two functions don't connect,i.e., Where the one function stops, the next one doesn't continue.
How do I create a continuous fit?
Any suggestions would be much appreciated, Amoré
p.s. Doing this part of my analysis in another program is unfortunately not an option.

回答 (0 件)

カテゴリ

Help Center および File ExchangeLeast Squares についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by