How can I find the changing maximum of a function as another parameter changes
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Valeria Garcia
el 23 de Jun. de 2015
Respondida: Udit Gupta
el 23 de Jun. de 2015
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
0 comentarios
Respuesta aceptada
Udit Gupta
el 23 de Jun. de 2015
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 comentarios
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!