mirror of
https://github.com/eddyem/stm32samples.git
synced 2025-12-06 18:55:13 +03:00
14 lines
408 B
Matlab
14 lines
408 B
Matlab
function idx = getknots(X, Y, dYmax)
|
|
%
|
|
% idx = getknots(X, Y, dYmax) - calculate piecewise-linear approximation knots for Y(X)
|
|
% dYmax - maximal deviation
|
|
%
|
|
idx = [];
|
|
I = getnewpt(X, Y, dYmax);
|
|
if(I > 0)
|
|
L = getknots(X(1:I), Y(1:I), dYmax);
|
|
R = I-1 + getknots(X(I:end), Y(I:end), dYmax);
|
|
idx = [L I R];
|
|
endif
|
|
endfunction
|