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!