clc;
clear;
close all;

x = chebfun('x', [-5 5]);
f = sin(x).*sin(1.5*x);
df = diff(f);
d2f = diff(df);

[~, e] = minandmax(f, 'local');
[~, maxima] = max(f, 'local');
[~, minima] = min(f, 'local');

figure;
plot(f);
hold on;
plot(e, f(e), 'ko', 'MarkerSize', 12);
plot(maxima, f(maxima), 'r.', 'MarkerSize', 20);
plot(minima, f(minima), 'b.', 'MarkerSize', 20);
grid on;
