MATHEMATICA TUTORIAL

# Manipulating Numerical Data

When you have numerical data, it is often convenient to find a simple formula that approximates it. For example, you can try to "fit" a line or curve through the points in your data.

 Fit[{y1,y2,...},{f1, f2,...},x] fit the values to a linear combination of functions Fit[{{x1,y1},{x2,y2},...},{f1, f2,...},x] fit the points to a linear combination of the

Fitting curves to linear combinations of functions.

This generates a table of the numerical values of the exponential function. Table is discussed in "Making Tables of Values".
 Out[1]=
This finds a least-squares fit to of the form . The elements of are assumed to correspond to values , , ... of .
 Out[2]=
This finds a fit of the form .
 Out[3]=
This gives a table of , pairs.
 Out[4]=
This finds a fit to the new data, of the form .
 Out[5]=
 FindFit[data,form,{p1,p2,...},x] find a fit to form with parameters

Fitting data to general forms.

This finds the best parameters for a linear fit.
 Out[6]=
This does a nonlinear fit.
 Out[7]=

One common way of picking out "signals" in numerical data is to find the Fourier transform, or frequency spectrum, of the data.

 Fourier[data] numerical Fourier transform InverseFourier[data] inverse Fourier transform

Fourier transforms.

Here is a simple square pulse.
 Out[8]=
This takes the Fourier transform of the pulse.
 Out[9]=

Note that the Fourier function in Mathematica is defined with the sign convention typically used in the physical sciences—opposite to the one often used in electrical engineering. "Discrete Fourier Transforms" gives more details.

## Tutorial CollectionTutorial Collection

New to Mathematica? Find your learning path »
Have a question? Ask support »