Creating a Program to Call a Solve Block in Mathcad
|
Here's an example of setting up a small program to call a Solve Block from a program. |
|
Parameter to be estimated |
|
Simulation for One Fit using a Solve Block |
|
Set up your constraint starting with Given in a math region: |
|
Constraint to find the p that minimizes the sum of the squares of the differences to find a best fit p value. |
|
The fitting function follows the data very closely |
|
Solution for Multiple Data Sets: |
|
To find the best p for a particular data set (called C in this example), make the Solve Block into a function of the data set. |
|
Cycle through the columns of data using a for loop, Pass the ith column of M to the F function to return the parameter p for that column. The results are stored in a vector, RES, which is returned by the program. |
|
Solutions for each column of M |
Right-click, choose Save Target As, and change the extension to XMCD and File Type to All to download Mathcad file (version Mathcad 13).
|
Was this article helpful? Let us know.
|
[PRINTER FRIENDLY VERSION]
|