MATLAB: Find the maximum value of a function

functionMATLABmaximum

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 ?

Best Answer

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)