Clear Filters
Clear Filters

Determine the intervals on which the function f(x) is increasing and decreasing

24 views (last 30 days)
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])

Accepted Answer

Walter Roberson
Walter Roberson on 6 Dec 2020
syms x
f = sinh(x.^2);
g = diff(f);
sol = solve(g == 0, 'returnconditions', true)
sol = struct with fields:
x: [3×1 sym] parameters: [1×1 sym] conditions: [3×1 sym]
sol.x
ans = 
sol.conditions
ans = 
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))
curl = 
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.
  1 Comment
Duncan Weakley
Duncan Weakley on 7 Dec 2020
Thank you so much!
This was a great explanation!
Extremely thankful for the help, I've been struggeling with this problem for 2 days.

Sign in to comment.

More Answers (1)

tarun Kumar v
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])

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!