mirror of
https://github.com/eddyem/stm32samples.git
synced 2026-02-28 20:04:30 +03:00
restructuring
This commit is contained in:
8
F0:F030,F042,F072/Socket_fans/knots/linearapprox.m
Normal file
8
F0:F030,F042,F072/Socket_fans/knots/linearapprox.m
Normal file
@@ -0,0 +1,8 @@
|
||||
function [x0 y0 k] = linearapprox(X,Y)
|
||||
%
|
||||
% [a b] = linearapprox(X,Y) - find linear approximation of function Y(X) through first and last points
|
||||
% y = y0 + k*(X-x0)
|
||||
%
|
||||
x0 = X(1); y0 = Y(1);
|
||||
k = (Y(end) - y0) / (X(end) - x0);
|
||||
endfunction
|
||||
Reference in New Issue
Block a user