How can I find the changing maximum of a function as another parameter changes

2 次查看(过去 30 天)
For example if I have a function:
y=-Ax^2+Bx+C-Dcos(Ax)
where A B C and D are constants and x is the independent variable
I would like to find the maximum of the function at different values of A

采纳的回答

Udit Gupta
Udit Gupta 2015-6-23
The fact that you require to find something with different values of A implies that A can no longer be treated as a constant. So in effect this is a two dimensional function
y(A,x) =-Ax^2+Bx+C-Dcos(Ax)
To find the maximum you can use various methods -
1.you can wither use multi-dimensional derivatives to find maxima, minima and saddle points (see a calculus textbook)
2. In matlab use meshgrid to continuously vary A and x and plot a surface plot to find the maximum.
3. Realize that y is a sum of a quadratic function and a periodic cosine. The extrima of a quadratic function is the vertex (can be either maxima or minima depending on sign of A) and that the periodic function varies between +/-D. So analyzing it becomes not too difficult.

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by