find the maximum value of a function

조회 수: 27 (최근 30일)
Ken Le
Ken Le 2018년 11월 19일
편집: Andrew Robertson 2019년 10월 29일
It's given that y(x) = log(14*x+30) on [a b]
how can I find the maximum value of diff(y,2) for every a and b which is satisfied 14*x + 30 > 0 ?
  댓글 수: 2
John D'Errico
John D'Errico 2018년 11월 19일
What have you tried? If nothing, why not, on what is surely homework? If you want help, then make an effort. Show what you have tried. Then explain wht went wrong, and where you think you need to go next.
Ken Le
Ken Le 2018년 11월 19일
My homework is to approximate an integer by dividing it into smaller sum, but the equation itself need the maximum value of the absolute of the second differental of the function itself. I tried to find the maximum value by calculating the smaller piece but the dimension is still too big. Sorry for the grammar.

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

채택된 답변

Dimitris Kalogiros
Dimitris Kalogiros 2018년 11월 19일
Hi Ken
Use the following script in order to analyse your function:
clearvars; clc; close all;
syms x
% definition of the function
assume(x>-14/30)
y(x)=log(14*x+30)
% calculating 2nd derivative
y2(x)=diff(y,2)
% plot second derivative
fplot(y2, [-13/30 10]); grid on; zoom on;
You will get the formula and the graph of the 2nd derivative of your function:
We get that diff(y,2) is an monotonically ascending function. So its maximum value is always at x=b (and its minimum at x=a)

추가 답변 (3개)

Torsten
Torsten 2018년 11월 19일
The maximum value for diff(y,2) is attained in x=b with value -(14/(14*b+30))^2.
  댓글 수: 2
Ken Le
Ken Le 2018년 11월 19일
The only reason why we know it's x=b because diff(y,2) alway negative . So what can I do more if the mark of it is unknown ?
Torsten
Torsten 2018년 11월 19일
편집: Torsten 2018년 11월 19일
This answers your question. If you want something else, please ask what you really want to know.

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


Matt J
Matt J 2018년 11월 19일
편집: Matt J 2018년 11월 19일
You can use fminbnd as applied to .
  댓글 수: 1
Ken Le
Ken Le 2018년 11월 19일
편집: Ken Le 2018년 11월 19일
I'm gonna take a look at this, Thanks.

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


Andrew Robertson
Andrew Robertson 2019년 10월 29일
편집: Andrew Robertson 2019년 10월 29일
Discraceful are all the answers!, he may have not been specific in the details of his question, and no one answered, or even came close to the proper answer!.
I believe he is having the same issue i am, I have a complex sum, and when I do "result = max(MyFunction)",
the answer i get is the function with the inputs into it to give the maximum result!, what the f%^k! who wrote this s@#T!?
I wanted the maximum result as a number, not a function, if i had asked for the result of a function, I would have looked for a code call to do so!.
So my problem, the same as the origianl ask, is, how do i get a number of a max call, not the garbage I am getting now?
And a 2nd question, the figure matlab found to put into the function to get the max(and minimum) how do i extract that?
Andrew
P.S. I feel greatly elated to know I got a badge for this comment!
  댓글 수: 3
Matt J
Matt J 2019년 10월 29일
편집: Matt J 2019년 10월 29일
he may have not been specific in the details of his question, and no one answered, or even came close to the proper answer!.
If not, then why did you suppose he Accept-clicked the answer provided by Dimitris?
Andrew Robertson
Andrew Robertson 2019년 10월 29일
편집: Andrew Robertson 2019년 10월 29일
I suppose he clicked accept to an answer, as, he not knowing much about matlab thought (likely incorrectly) he had got the best and correct answer!.
He asked for a maximum value!, a number, and he now has the tools to get it,
I did not answer his 2nd part, being to satisfy an equation, but that is the easy part, just start x at x > -30/14 or start x at -30/14 + 0.00001 that is, according to his equation!

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

카테고리

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

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by