Optimization in the presence of symbolic parameters

Hello,
I have an optimization problem, let's say finding the minimum of fun(x) where x is a real scalar, where for example: fun(x) = A*tanh(x) - x^2; The function fun has a parameter A which I'd like to specify as a symbolic variable such that the solution x is given as a function of A. The brute force solution will be to go over different valid values of A and finding x per each such value of A. Is there a way for Matlab to output x as a function of A instead?

 Accepted Answer

Something like
syms A x
f(x)=A*tanh(x)-x^2;
solve(diff(f)==0,x);
?
Best wishes
Torsten.

More Answers (0)

Asked:

Nir
on 20 Nov 2014

Answered:

on 20 Nov 2014

Community Treasure Hunt

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

Start Hunting!