Maximum of my own function

1 回表示 (過去 30 日間)
Piotr Grzybowski
Piotr Grzybowski 2016 年 10 月 16 日
編集済み: Marc Jakobi 2016 年 10 月 16 日
Using matlab find maximal values of functions f1 and f2 given by following formulas:
f1'(x) = 5x + 2
f2'(x) = 6x^2 - 3
f1(0) = f2(0) = 100
From my point of view there is of course nothing to use Matlab, both functions f1 and f2 goes to infinity of course but my teacher gave me that exercise.
I tried to solve this with "sym" "symfun" classes, I can count integrals deviratives, but how to get MAX of function on range (-inf, inf)?
Or maybe I've understood exercise bad? Hope for small help, thx for yout time!
  3 件のコメント
Piotr Grzybowski
Piotr Grzybowski 2016 年 10 月 16 日
Yes, I forgot about it.
f1' is a derivative of f1. But in fact it doesn't change anything in this case.
Not always it will be infinity, how about f(x) = -x^2 + 4 on range x in [-inf, inf] the maximum is 4.
Marc Jakobi
Marc Jakobi 2016 年 10 月 16 日
Are you sure you are supposed to find the maximal values and not the extrema?

サインインしてコメントする。

採用された回答

Marc Jakobi
Marc Jakobi 2016 年 10 月 16 日
編集済み: Marc Jakobi 2016 年 10 月 16 日
syms x
f1 = 5*x + 2;
F1 = int(f1); % integrate
x_ext = solve(f1 == 0); % solve for x = 0
% limits for x --> -inf & inf
m1 = limit(F1, inf);
m2 = limit(F1, -inf);
% evaluate F1 at extreme point
m3 = subs(F1, x_ext);
% compare results
Maxf1 = max(double([m1; m2; m3]));
f2 = 6*x^2 - 3;
F2 = int(f2);
x_ext = solve(f2 == 0);
m1 = limit(F2, inf);
m2 = limit(F2, -inf);
m3 = subs(F2, x_ext);
Maxf2 = max(double([m1; m2; m3]));
I don't know how F1(100) == F2(100) = 0 would be relevant, though.

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by