how to fit a curve by splitting it into linear region and quadratic region?
2 ビュー (過去 30 日間)
古いコメントを表示
curve is about lift coefficient versus blade incidence which has linear porion to some extend and after the peak is reached it follows a quadratic trend so please tell me how to split the curve into linear and quadratic portion before and after the peak respectively.
1 件のコメント
Image Analyst
2012 年 8 月 14 日
A diagram, picture, plot, image, chart, etc. would be helpful. Try uploading one to tinypic.com.
回答 (1 件)
Tom Lane
2012 年 8 月 15 日
Maybe you can get somewhere by trying this and imitating it:
x = linspace(0,10)';
y = 2 + x - (x-5).*(x>5) - (x-5).^2.*(x>5) + randn(size(x));
ft = fittype('a + b*x + c*(x-5).*(x>5) + d*(x-5).^2.*(x>5)')
f = fit(x,y,ft,'start',[1 1 1 1])
plot(x,y,'bx',x,f(x),'r-')
The basic idea is to use conditionals in the function expression and fit using a nonlinear fitter. These can be hard to fit because of non-smoothness, especially if you want to estimate the transition point which I just set to 5 here. I forced the curve to be continuous; you could do otherwise. I used the fit function from Curve Fitting Toolbox, but fminsearch, nlinfit, or various Optimization Toolbox functions could also work.
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!