![]() Volume 9, Issue 2 Articles Tricks of the Trade In and Out Trott's Corner New Products New Publications Calendar News Bulletins New Resources Classifieds Download This Issue Editorial Policy Staff Submissions Subscriptions Advertising Back Issues Contact Information |
In and Out
NonlinearRegress Q: Consider the following initial-value problem.
The differential equation cannot be solved explicitly so you have to use NDSolve. How can I use the output of NDSolve as the model function argument to NonlinearRegress? A: Carl Woll (carlw@u.washington.edu) writes: Basically, there are four steps. 1. Define the model with both the parameters and variables restricted to numeric quantities to prevent NDSolve from being given symbolic input. 2. Compute the derivatives of the model with respect to each parameter. 3. Teach Mathematica about these derivatives. 4. Use NonlinearRegress as usual. After restricting the input parameters
Plot the solution for
Next, compute the derivatives of
Then use NDSolve on the system of ordinary differential equations, consisting of the original and the differentiated equations.
After you have computed the derivatives of the model with respect to the parameters, teach Mathematica this information.
Next, use NonlinearRegress in the usual way. Load the package.
Create some noisy data.
Then run NonlinearRegress.
View the best-fit solution.
This method allows you to use the full power of NonlinearRegress in a simple and very natural way. There are other approaches, but most of them require that you either use the FindMinimum method of NonlinearRegress, or that you abandon NonlinearRegress (and all of its statistical feedback) and use FindMinimum directly.
|
||||||||
About Mathematica | Download Mathematica Player Copyright © 2004 Wolfram Media, Inc. All rights reserved. |