Determine the extreme values for the function f(x)
28 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi there
I need to determine the extreme values for the function f(x) on the interval [0,4]
I am gridlocked with this
I am trying to use vpa, but only get one answer
I need to determine the local maximum and mininum values as well as global
I need this rounded to 4 decimals, and I dont see how simply reading it of the graph can help since 1. the graph give 3 decimals and 2. I dont see that i can place the cursor accurate enough
syms x
total_function = x.*(cos(x.^2)) - exp(sqrt(x))+x.^3 - 4*(x.^2);
f = x.*(cos(x.^2)) - exp(sqrt(x));
g = x.^3 - 4*(x.^2);
dif = diff(x.*(cos(x.^2)) - exp(sqrt(x))) + diff(x.^3 - 4*(x.^2));
vpasolve(dif == 0, x, 4);
extrema = vpa(ans, 6)
fplot(total_function)
xlim([0 4])
Thank you for your help in advance
0 Kommentare
Antworten (1)
Rohit Pappu
am 28 Dez. 2020
To determine the extrema, optimization toolbox can be used . For example
%% Finding local minima in [0,4] using fminbnd
minima = fminbnd(@(y) y.*cos(y.^2) - exp(sqrt(y))+y.^3-4.*(y.^2),0,4);
%% Finding local minima of -f(x) to get the maxima of f(x)
maxima = fminbnd(@(y) -y.*cos(y.^2) + exp(sqrt(y))-y.^3+4.*(y.^2),0,4);
0 Kommentare
Siehe auch
Kategorien
Mehr zu Line Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!