Determine the intervals on which the function f(x) is increasing and decreasing
24 views (last 30 days)
Show older comments
Duncan Weakley
on 6 Dec 2020
Answered: tarun Kumar v
on 26 Nov 2021
Hi there
I am struggeling to compute this
I need to get the intervals where f(x) is increasing rounded to 4 decimal values as output
I realise it will be where f'(x)>0 and f'(x)<0
this is what i got sofar:
clf
f = sinh(x.^2);
h = sqrt(cosh(x)-1);
fplot(diff(f)-diff(h))
grid on
ylim([-5 5])
xlim([-5 5])
0 Comments
Accepted Answer
Walter Roberson
on 6 Dec 2020
syms x
f = sinh(x.^2);
g = diff(f);
sol = solve(g == 0, 'returnconditions', true)
sol.x
sol.conditions
by inspection: (-1)^(1/4) is complex-valued. sqrt(k+1/2) is complex valued for integer k <= -1, and complex times the complex root of unity is potentially real-valued. For integer k = 0 and upwards, sqrt(k+1/2) is real valued, and real times the complex root of unity is always complex-valued.
Therefore, we only need to consider k = -1 and less
assume(sol.parameters, 'integer')
curl = simplify(subs(diff(g), x, sol.x))
The signs of those are the important parts: positive for local minima, negative for local maxima. For negative k, 2*k+1 is always negative, and -2*pi is always negative, so the sign comes down to the sign of (-1)^k which is negative for odd k (local maxima) and positive for even k (local minima)
sol.x tells you where the critical points are; curl tells you the maxima / minima. If you are at a local maxima, then everything to the next local minima (greater x, so decreasing k) is decreasing; if you are at a local minima, then everything until the next local maxima (greater x, so decreasing k) is increasing.
More Answers (1)
tarun Kumar v
on 26 Nov 2021
clf
f = sinh(x.^2);
h = sqrt(cosh(x)-1);
fplot(diff(f)-diff(h))
grid on
ylim([-5 5])
xlim([-5 5])
0 Comments
See Also
Categories
Find more on Time Series in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!