Can I fit multiple data sets using the Basic Fitting Tool in MATLAB?

98 views (last 30 days)
After plotting multiple data sets in a MATLAB figure window, selecting "Tools > Basic Fitting", and using the "Select data" menu to select a data set, I can fit an equation to the selected data.
When I select a different data set, however, the previous fit is erased.
How can I view fits to more than one data set in the same figure window?

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Oct 2013
The ability to fit multiple data sets is not available in the Basic Fitting Tool.
There are several workarounds:
1. Use the "Numerical results" panel of the Basic Fitting Tool to save each fit to the workspace, then plot the data sets and the fits to the same figure window using the HOLD command.
2. Use the MATLAB backslash operator (\) to produce the fits and the plots from a MATLAB script.
3. Use the Curve Fitting Toolbox.
  2 Comments
Saurabh Harsh
Saurabh Harsh on 24 Apr 2015
Since the basic fitting tool has limited functionality the output is not an object which can be plotted directly. The returned fit structure contains information about the fit and the y values can be regenerated using these.
Please contact Mathworks Technical support if you have additional questions.

Sign in to comment.

More Answers (1)

Thishan Dharshana Karandana Gamalathge
I am using MATLAB_R2016a. With this newer version, can i get the things done? If so, how? Still I cannot save the curve i fit for data set one, to have the curve fit on data set two for camparison.

Community Treasure Hunt

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

Start Hunting!

Translated by