Borrar filtros
Borrar filtros

How to fit data to my customized form automatically?

3 visualizaciones (últimos 30 días)
Zhiting
Zhiting el 23 de Feb. de 2011
I have quite a few sets of data and I want to fit them to y=a-b*x^3. I know that I could use cftool and do it manually for each data set. But it is really tedious. Is it a better way to do it? Thanks a lot.

Respuesta aceptada

Jiro Doke
Jiro Doke el 23 de Feb. de 2011
Since you're already using Curve Fitting Toolbox, use the underlying functions: fitttype and fit.
Example:
f = fittype('a-b*x^3', 'independent', 'x', 'coefficients', {'a', 'b'});
fitobj = fit(rand(10,1), rand(10,1), f)
Alternatively, you can generate MATLAB code from cftool.

Más respuestas (1)

Paulo Silva
Paulo Silva el 23 de Feb. de 2011
doc polyfit
  3 comentarios
Paulo Silva
Paulo Silva el 23 de Feb. de 2011
you get the p values from polyfit
Zhiting
Zhiting el 23 de Feb. de 2011
I want to fix p1 and p2 to be 0. I need y=p3*x^3+p0.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by