## Table of contents

- Polar plots
- Vector plots
- Batch processing (processing several files automatically)
- Calculating residuals
- Fitting differential equations

## Polar plots

*How do I create a polar plot with pro Fit?*

The pro Fit example files contain a script called “Polar plot”, which is located in the folder “Functions & Programs”. This script can be used to generate polar plots. To use the script, proceed as follows:

- Open the document “Polar plot”.
- Choose “Compile and Add to Menu” from the Customize menu to add the script to pro Fit’s menus.
- Open a data window and enter your data points. One column must contain the angles of your data points (in degrees), and another column must contain the corresponding radius.
- Choose “PolarPlot” from the Script menu to plot the data points.

For an example of a polar plot, have a look at the file “Polar plot” in the folder “Examples/Plotting – advanced” of your pro Fit example files.

## Vector plots

*I would like to create a vector plot, i.e. a plot that shows a field of vectors (arrows). How can I do this?*

The pro Fit package contains a script called “Plot vector field”, which is located in the folder “Functions & Programs”. This script can be used for generating vector plots. To use the script, proceed as follows:

- Open the document “Plot vector field.
- Choose “Compile and Add to Menu” from the Customize menu to add the script to pro Fit’s menus.
- Open a data window and enter your data points. Prepare the following columns.
- A column for the x-coordinate of each vector.
- A column for the y-coordinate of each vector.
- A column with the length of each vector.
- A column with the angle (direction) of each vector in radians.

- Choose “VectorField” from the Misc menu to plot the data points.

For an example of a vector plot, have a look at the file “Flow plot” in the folder “Examples/Plotting – vector fields” of your pro Fit example files. Further comments are provided at the beginning of the file “Plot vector field”

## Batch processing

*I have a large number of data files, each containing a data set. I want to fit each data set and create a table with all fitted parameters. I can do this by hand, of course, but is there any way to do it automatically?*

Yes, there is. What you want to do is called “batch processing”. There are several ways to do this with pro Fit:

- You can open all the files by hand (select all of them in the finder and double-click). Then you write a script that cycles through all windows (using the call
`NextWindow`

) and, if a window is a data window (use the call`GetWindowType`

to find out), it runs a fit using the data in this window. - Put all files to process into a common folder. Write an Apple Script that goes through all the files in this folder. For each file, the Apple Script tells pro Fit to open it and to run a fit.
- Write an external module that goes through all the files, opening each one and fitting it. This requires in-depth scriptming knowledge of the Mac OS File Manager.

For a detailed discussion of this problem, look at the TechNote “Batch processing“.

The pro Fit example files contain an example for batch processing using an Apple Script. Look at the script file “Batch processing” in the folder “Examples/AppleScript”.

## Calculating residuals

*How do I calculate and plot residuals (i.e. the differences between the fitted function and the data points) after having run a fit?*

To calculate the residuals of a fit, proceed as follows:

- Run the fit as usual: Choose Nonlinear Fit from the Calc menu, choose the fit options, and click OK.
- When the fit is complete, choose the command Table from the Calc menu. In the dialog box that comes up, set the field “Step” to “points”. Then click OK. pro Fit calculates a table that contains the x-values of the fitted data set in the first column, the y-values of the fitted function in the second column, the y-values of the data points in the third column, and the residuals (the differences between the second and third columns) in the fourth column.
- Use the residuals in whatever way you want. If you want to view them in the preview window, click into the column number (4) of the residual column while holding down the command key and choose “Y” in the pop-up menu that comes up.

## Fitting differential equations

*I have a differential equation that describes the behaviour of my experiment. The equation contains several parameters, the values of which I want to calculate by fitting the equation to my experimental data. How can I do this in pro Fit?*

To fit a differential equation (or a set of coupled differential equations), you have to write a pro Fit function that solves the equation(s) numerically. The TechNote “Fitting differential equations” that comes with the pro Fit package in the folder “Notes” contains a detailed discussion on how to do this.