How to interpret this result max on a function just like using fplot on function?

조회 수: 1 (최근 30일)
How do we explain this result from MATLAB?
>> max('sin(x)')
ans =
120
Also help of max says
"POLYNOM/max find maximum of polynomial if it exists"
hoW do we use this sort of max in MATLAB? I do not know what POLYNOM/max means.
  댓글 수: 2
Seetha Rama Raju Sanapala
Seetha Rama Raju Sanapala 2015년 11월 21일
Walter Roberson:Lucid and clear explanation. I think MATLAB should have a function (if not present now, they should think of making it) for finding the max of a function with in some range of independent variable. If we can plot a function, it should be possible to find its maximum too.
Do you know second part of the question? How to use max as suggested in the help given above.
Walter Roberson
Walter Roberson 2015년 11월 21일
POLYNOM/max that you are looking at is the help for a max function for a class named 'POLYNOM'. I do not find a record of that class existing in MATLAB. For true polynomials I do find someone who posted a method that uses minmax() from the Neural Network toolbox.

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2015년 11월 21일
'sin(x)' is a character string, which is a vector of characters. Characters are internally represented in binary in terms of positions in a standardized set of characters. MATLAB in particular uses two byte Unicode, so characters are represented as binary values between 0 and 65535 . For example, 'A' represented by the value 65 -- char(65) == 'A'
The binary values that make up the string 'sin(x)' are [115 105 110 40 120 41] . The largest of those values is 120, and that is what max('sin(x)') returns.
max() cannot be applied to a function handle: it can only be applied to the result of invoking the function.
max() also cannot be applied to symbolic expressions. Historically it could not even be applied to numbers represented in symbolic form, but it is possible that that might be added by now. It is possible to call in to the symbolic engine to find the maximum of a vector or array of symbolic numbers, but the symbolic engine cannot find the maximum of a symbolic expression involving variables.
The symbolic engine can be called for mixed integer linear optimization
If you want to maximize a function by using calculus techniques then I do not see a predefined routine to do that at the moment. There is the traditional method of differentiating the function and finding the roots of the resulting expression to locate the critical points, and substituting the critical points into the second derivative in order to determine whether each point is a maximum or minimum.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by