Curve Fitting Toolbox | ![]() ![]() |
Importing the Data
Before you can import data into the Curve Fitting Tool, the data variables must exist in the MATLAB workspace. For this example, the data is stored in the file census.mat
, which is provided with MATLAB.
The workspace now contains two new variables, cdate
and pop
:
cdate
is a column vector containing the years 1790 to 1990 in 10-year increments.
pop
is a column vector with the US population figures that correspond to the years in cdate
.
You can import data into the Curve Fitting Tool with the Data GUI. You open this GUI by clicking the Data button on the Curve Fitting Tool. As shown below, the Data GUI consists of two panes: Data sets and Smooth. The Data Sets pane allows you to
To load cdate
and pop
into the Curve Fitting Tool, select the appropriate variable names from the X Data and Y Data lists. The data is then displayed in the Preview window. Click the Create data set button to complete the data import process.
The Smooth pane is described in Importing, Viewing, and Preprocessing Data.
![]() | Opening the Curve Fitting Tool | Fitting the Data | ![]() |