필터 지우기
필터 지우기

How to fit data to my customized form automatically?

조회 수: 3 (최근 30일)
Zhiting
Zhiting 2011년 2월 23일
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.

채택된 답변

Jiro Doke
Jiro Doke 2011년 2월 23일
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.

추가 답변 (1개)

Paulo Silva
Paulo Silva 2011년 2월 23일
doc polyfit
  댓글 수: 3
Paulo Silva
Paulo Silva 2011년 2월 23일
you get the p values from polyfit
Zhiting
Zhiting 2011년 2월 23일
I want to fix p1 and p2 to be 0. I need y=p3*x^3+p0.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by