You can combine ExceLab calculus functions with either native Excel Solver or NLSOLVE to solve a variety of parameter estimation and dynamical optimization problems.
If you have learned how to obtain a solution with the calculus functions, you are almost done! Setting up a parameter or dynamical optimization problem is straightforward with just a couple more steps:
Solve your model as you would normally do using the relevant calculus solvers. Make sure to use variables with initial reasonable values for the model parameters you want to optimize instead of just hardcoding their values into your model formulas.
Your design parameters can be any parameters that influence the system behavior including coefficients, bcs, initial values, etc.
The next step is to define constraint formulas to penalize the deviation of your initial solution from your target value.
NLSOLVE interprets equality constraints in relation to zero and inequality constraints in relation to greater than or equal to zero.
Typically you specify a constraint formula in the following form:
= Initial solution value – Target Value
DYNVAL
is a dummy function that simply returns the value of its argument but in this context, it ensures that its argument is dynamically evaluated during the optimization.
The final step is to solve for the optimal model parameters that will satisfy your constraints formula (i.e., drive their values to zero). You have two choices: