mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 11:54:30 +03:00
restructuring
This commit is contained in:
17
F0:F030,F042,F072/Socket_fans/knots/getnewpt.m
Normal file
17
F0:F030,F042,F072/Socket_fans/knots/getnewpt.m
Normal file
@@ -0,0 +1,17 @@
|
||||
function idx = getnewpt(X, Y, delt)
|
||||
%
|
||||
% idx = getnewpt(X, Y, delt)
|
||||
% find point where Y-`linear approx` is maximal
|
||||
% return index of max deviation or -1 if it is less than `delt`
|
||||
%
|
||||
% make approximation
|
||||
[x0 y0 k] = linearapprox(X,Y);
|
||||
% find new knot
|
||||
adiff = abs(Y - (y0 + k*(X-x0)));
|
||||
maxadiff = max(adiff);
|
||||
if(maxadiff < delt)
|
||||
idx = -1;
|
||||
else
|
||||
idx = find(adiff == max(adiff));
|
||||
endif
|
||||
endfunction
|
||||
Reference in New Issue
Block a user