How to use curve fitting toolbox automatically deal with curves?
조회 수: 2 (최근 30일)
이전 댓글 표시
I get a group of data,Here I attached.and I just want to know how to do it automatically instead of curve fitting one curve for once time.who can give me some advice? or tell me how to write a code for this.Additional I get one function for these curves ,but I don't know how to confirm the initial value.Function is f(x)=a+b/(1+(d*x)^c)
답변 (1개)
Pratik Bajaria
2014년 8월 13일
That's True! Even I can't find attachment. Irrespective of that, if you would like to do curve fitting via command line, you can go through the following. http://www.mathworks.in/help/curvefit/fit.html http://www.mathworks.in/help/matlab/ref/polyfit.html and the related functions too. I guess, this is what your question is. 'To run it directly from Matlab command prompt, rather than by conventional 'cftool' and processing and stuff'. Correct me if i am wrong.
Hope this helps!
Regards, Pratik
댓글 수: 3
Pratik Bajaria
2014년 8월 14일
Well it's simple.
A 4 step process. 1. Read the excel into MATLAB using 'xlsread' function. 2. use fit function to fit y1 and time. 3. Use a for loop to span through all the columns. 4. Keep running and save them in a Cell or Structure in MATLAB until the last column and that's it.
Go though the example on the site it will be easier.
Regards, Pratik
Pratik Bajaria
2014년 8월 14일
For example,
[num,text,raw]=xlsread('m1.xlsx');
x=num(1:398,1);
y=num(1:398,2);
cf=fit(x,y,'smoothingspline');
cf
This works just fine for one set of data. Now we can run a for loop in order to get the fits for other sets in the excel sheet. Then it can be stored in a MATLAB cell, like '*cfs{1}=cf*'.
Hope it helps.
Regards, Pratik
참고 항목
카테고리
Help Center 및 File 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!