Skip navigation
About Us Contact Us Software Support

Q: How can I use data to simulate a function?

A: A function can be approximated by knowing values along its curve, and the SAAM II Compartmental application can use linear interpolation on these values to simulate the original function.

The first step is to enter the known points into the Compartmental Data window as data. A data weight must be entered to satisfy the Data window syntax, even though it is not used. The example data and plotted values for the data (f1) are shown in Figures 1 and 2, respectively.

compartmental data window with example data

Figure 1

resulting plotted values

Figure 2

Once the data has been entered it can be used for almost any purpose in the model to simulate the original unknown function. One common use is to specify a Forcing Function. The Forcing Function is useful where a large model is split into two or more sections, and the interfaces between the sections are simulated by ‘forcing” the contents of a compartment to be the same as it would have been prior to removing that section of the model. To use data for that purpose, double-click on the compartment where the Forcing Function is to be applied to open the Compartment Attributes dialog box, and click on the Forcing Function button. In the Forcing Function box, click the Associate with Data radio button and enter the name of the data element in the adjacent entry area. When the model is Solved or Fitted, the application uses linear interpolation on the specified data to calculate the quantity in the compartment at any time during the experiment. A Forcing Function is an advanced feature of the Compartmental application. More details on how to use it are beyond the scope of this discussion.

A more common use is to assign the data values to a variable to simulate the original function. For this example, the data for f1 will be used to specify the exogenous input in the one compartment model shown in Figure 3.

compartmental model

Figure 3

To do this, double-click the input object ex1 to open the Exogenous Input dialog box. For the Input Type, click the Equation radio button. Enter 0.0 for the Event Start time, and 388.0 for Event Stop. For the equation, enter ex1 = lin(f1). The lin() function invokes the SAAM II linear interpolator to calculate the infusion rate at points other than where a value is specified in the data. Without this feature, the application would not be able to calculate the intermediate values needed for the integration. Note that the infusion times cannot extend beyond the first or last data point since the linear interpolator does not extrapolate. If the infusion is to run throughout the experiment, the end of the experiment must be specified at or prior to the last data point; otherwise the infusion will shut down before the experiment ends (in this example it would stop at time 388.0).

After the model has been Solved, a plot of the interpolated ex1 infusion curve superimposed on the original f1 data would appear as shown in Figure 4.  Depending upon the other characteristics of the model, the contents of compartment q1 during the experiment would appear similar to Figure 5.

resulting plot

Figure 4

resulting plot

Figure 5

<< Back to Support Page