Non-linear piecewise fit using fittype() and fit().
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello, I'm trying to fit some data to a rather complicated non-linear model:
y=(1-(x/R)^2)^n
where x is the independent variable with R and n constant. I need to fit this model to my data to find R and n. The problem I have is that this function returns complex values whenever n<1 and x>R. Thus I would like to make it a piecewise function so that c=0 when x>R. I can't figure out how to construct such a piecewise fit object using fittype(). Here's my code thus far for doing the fit:
ft = fittype( '(1-(x/R)^2)^n', 'independent', 'x', 'dependent', 'y' );
[fitresult, gof] = fit( xData, yData, ft)
Any ideas on how to do a non-linear piecewise fit? Thanks in advance for any insight.
Justin
0 comentarios
Respuesta aceptada
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear and Nonlinear Regression en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!