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 中查找有关 Interpolation 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!