source: MML/trunk/machine/SOLEIL/StorageRing/insertions/idLeastSqLineTilt.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 349 bytes
Line 
1function k = idLeastSqLineTilt(arArg, arFunc)
2
3k = 0;
4numArg = length(arArg);
5numFunc = length(arFunc);
6
7if (numArg ~= numFunc)
8    sprintf('Inconsistent numbers of points in the argument and function values arrays');
9    return;
10end
11
12s1 = 0;
13s2 = 0;
14for i = 1:numArg
15    s1 = s1 + arArg(i)*arFunc(i);
16    s2 = s2 + arArg(i)*arArg(i);
17end
18k = s1/s2;
Note: See TracBrowser for help on using the repository browser.