To find the extrema (maximum and minimum) of a function resulting from a change of variables in MATLAB, you can follow these general steps:
Here's an example illustrating these steps:
Suppose you have a function f(x, y) = x^2 + y^2
and you make a change of variables u = x + y
and v = x - y
. The corresponding function g(u, v)
can be found by substituting x = (u + v)/2
and y = (u - v)/2
into f(x, y)
.
main.m63 chars3 lines
Next, calculate the extrema of g(u, v)
by computing the derivative w.r.t. u
and v
:
main.m119 chars6 lines
The variables extrema_u
and extrema_v
will contain the values of u
and v
at which the extrema occur.
Remember, this is a general example and specific steps might vary based on the original function and the specific change of variables you are using.
gistlibby LogSnag