How do I fit a piecewise continuous function?
조회 수: 3 (최근 30일)
이전 댓글 표시
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
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!