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
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
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
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 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