September 2007
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.


Define a vector




Parameter to be estimated



Simulated data to be fit



Simulation for One Fit using a Solve Block


Set up your guess value



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:


Random Data Set




Guess





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]
HOME

Defining Weldments with Pro/ENGINEER Expert Framework
PTC Updates
Tips of the Month
Knowledge Base Exclusive
Mathcad Methods
Webcasts & Events
Streamlined Design with Pro/ENGINEER Advanced Assembly
Electronic Filter Simulation and Design with Mathcad

Contact PTC | Privacy Policy | PTC Express Archive | Subscribe | Unsubscribe | Change Preferences | Edit Profile

This e-mail was sent to:   PTC, 140 Kendrick Street, Needham, MA 02494 USA
If you are unable to read this page correctly, please click here