Integrate curve fitting toolbox in .m-File

6 views (last 30 days)
Hello everybody,
I have several different text files with data sets. All are looking the same, just the values in the cells differ. Now I have to find an equation which fits to the data set. After that I need to do some further math on this equation. And due to the fact that I have around 20 text files I would like to write a script which does all this automatically. At first I tried the "polyfit" method in my script. That worked pretty well and I was also able to integrate this into my "automatic" script. But the past few days I played with the curve fitting toolbox. And the results were way better. The only problem is, I have to start the toolbox by hand, do the selection of the data and the type of equation by hand and need to save the fitted curve manually to the workspace to do the further math. Now I would like to know, if it is possible to write a code which starts the Toolbox automatically, does the fitting, saves the fitted curve and continues with the further math.
I hope my explanation sounds not that weird and you guys are able to help me!
Cheers
Jan
  2 Comments
Adam
Adam on 23 Jan 2017
Edited: Adam on 23 Jan 2017
I don't have the curve fitting toolbox, but, in the nature of a toolbox, it contains many functions that do things 'automatically'. You haven't said what you are actually using. Even if you are using a GUI-based curve fitting program this can be launched programmatically like anything else, but it is hard to advise with no information as to what you are using.
Christian
Christian on 23 Jan 2017
Edited: Christian on 27 Mar 2017
Hey Adam!
Let me try to provide you as much information as you need: I am using Matlab 2016. There is a toolstrip named "Apps".
Currently I have to do this: Run my script to get all the data into the workspace
Open the Toolbox and select the x and y values and set a fitting method.
Save the fitted curve in my script
run the script again to do the further math on the fitted curve.
My goal is to write a script where I only have to press run, select the text File and wait till it has finished.

Sign in to comment.

Accepted Answer

Jan
Jan on 23 Jan 2017
If working with the curve fitting toolbox is possibloe, you can be sure, that this would be explained in the documentation. Therefore reading the docs is the best strategy: https://www.mathworks.com/products/curvefitting/features.html#working-with-curve-fitting-toolbox . Under "Working at the Command Line" you find examples of how to call the tools for fitting automatically. There are many examples also.
  1 Comment
Christian
Christian on 23 Jan 2017
Shame on me! I thought that might be such an exotic issue which I won't find in the documentary! But I found exactly what I was looking for in the doc of the Curve Fit App!
Thank you

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!