6 lines
151 B
Matlab
6 lines
151 B
Matlab
function [y_ext, x_ext] = extrema(y, x)
|
|
y_switch = switchsign( deriv(y, x) );
|
|
y_ext = nonzeros(y_switch .* y);
|
|
x_ext = nonzeros(y_switch .* x);
|
|
end
|