how to fit a curve by splitting it into linear region and quadratic region?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commento
Image Analyst
il 14 Ago 2012
A diagram, picture, plot, image, chart, etc. would be helpful. Try uploading one to tinypic.com.
Risposte (1)
Tom Lane
il 15 Ago 2012
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 Commenti
Vedere anche
Categorie
Scopri di più su Least Squares in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!