Add analysis of bound curve

This commit is contained in:
Ksyer
2024-02-22 10:52:46 +08:00
parent f0a14fae0f
commit a6956f3947
4 changed files with 1917 additions and 8 deletions
+12
View File
@@ -0,0 +1,12 @@
function [k, b] = linefit(x, y)
n = length(x);
x = reshape(x, n, 1);
y = reshape(y, n, 1);
A = [x, ones(n, 1)];
bb = y;
B = A' * A;
bb = A' * bb;
yy = B \ bb;
k = yy(1);
b = yy(2);
end