Symbolic function versus linear interpolation

6 views (last 30 days)
Hi Everyone,
I am solving a bounded ODE using bvp4c, where the objective function is dependent on another fully defined function.
The predefined function I feed into the objective by defining a nest function in the optimization function, for example if I'm solving the ODE
f'(x) = g(x)
where g(x) is my predefined function, then I pass into the solver
function dFdx = odefun(x, F) dFdx = g(x) end
function outg = g(x) %my evaluation of g(x) here end
now, there are two ways I can go about evaluating g(x), I can either evaluate a symbolic function, for example g(x) = e^-2*x, or I can generate a vector of values for g(x) and use outg = interp1(x_vec, g_vec, x).
My question is: does anyone have any intuition on which method - linear interpolation or symbolic evaluation - is computationally superior?
Thanks!
  1 Comment
Darin
Darin on 16 Jun 2013
I should specify actually that for the symbolic function method I could really do one of three things:
  • use a fit object (cfit object) - specifically a biexponentially - using feval
  • use a symbolic function
  • pull the parameters of the symbolic function and use an analytic expression.

Sign in to comment.

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!