How can we automate Curve Fitting Tool (cftool) processes?
조회 수: 4 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2017년 5월 26일
답변: MathWorks Support Team
2017년 6월 2일
I use the Curve Fitting Tool in my workflow. Right now my method is semi automated. I define variables as my stretch data, pull them up in cftool, fit with a gaussian fit. I then type in the a1, b1, and c1 variable outputs in the cftool results window and run my program which graphs the derivative and searches for the max value. How would you automate this process? It's about a ten minute process and I have a large amount of samples to run.
채택된 답변
MathWorks Support Team
2017년 5월 26일
The "cftool" function has a feature that allows you to generate MATLAB code that will carry out the same fitting as you have set up in the tool.
This feature is located in the Curve Fitting Tool Window > File > Generate Code.
When you run the code generated by the tool, it will output a "cfit" or "fit" object, depending on what kind of fitting you are doing.
Once you have created this object, you can use the functions "coeffnames" and "coeffvalues" in order to access those a1, b1, and c1 values.
>>coeffvalues(fitresult)
So, to summarize, once you've generated code for your fit a single time, you can then re-run that function as many times as you need and thus automatically extract those values and automate the process.
For more information about generating code from the Curve Fitting Tool, please read the following guides:
https://www.mathworks.com/help/releases/R2017a/curvefit/generating-matlab-code-and-exporting-fits.html
https://www.mathworks.com/help/releases/R2017a/curvefit/generating-code-and-exporting-fits-to-the-workspace.html
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!