Finding the maxima/minima

6 ビュー (過去 30 日間)
Ikenna Iwudike
Ikenna Iwudike 2022 年 4 月 2 日
回答済み: Walter Roberson 2022 年 4 月 2 日
f(x, y) = e^x − sin (y) on the ellipse g(x, y) = x^2 + 3*y^2 = 1
I was told to parametrize the ellipse by x = cos(t), y = (1/sqrt(3))*sin(t), Substitute it into the formula for f , get a function of the single variable t and find its maximum and minimum on the interval [0, 2π] using fminbnd. I was able to find the minimum but I'm having trouble finding the maximum. Here's what I have so far:
syms t
x = cos(t);
y = (1/sqrt(3))*sin(t);
f = exp(x) - sin(y);
f = @(t) exp(cos(t)) - sin((3^(1/2)*sin(t))/3);
tmin = fminbnd(f,0,2*pi)
fmin = exp(cos(tmin)) - sin((3^(1/2)*sin(tmin))/3)

採用された回答

Walter Roberson
Walter Roberson 2022 年 4 月 2 日
[tmin, fmin] = fminbnd(f,0,2*pi)
nf = @(x)-f(x);
[tmax, fmax] = fminbnd(nf,0,2*pi)

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by