source: MML/trunk/machine/SOLEIL/StorageRing/BBA/qualFit.m @ 17

Last change on this file since 17 was 17, checked in by zhangj, 11 years ago

To have a stable version on the server.

  • Property svn:executable set to *
File size: 694 bytes
Line 
1function rmsFit = qualFit(x1,y1,co)
2%QUALFIT - Calcule l'écart type de la distance entre la parabole calculée
3%et les données expériementales
4%
5%  INPUTS
6%  1  x1
7%  2. x2
8%  3. co
9%
10%  OUPUTS
11%  1. rmsfit
12%
13%  See Also bba_last
14
15%co=polyfit(x1,y1,2)
16
17for i=1:length(x1),
18    cub(1) = 2*co(1)^2;
19    cub(2) = 3*co(1)*co(2);
20    cub(3) = co(2)^2+2*co(1)*(co(3)-y1(i))+1;
21    cub(4) = co(2)*(co(3)-y1(i))-x1(i);
22
23    solcub = roots(cub);
24
25    [res,ind] = sort([abs(solcub(1)-x1(i)) abs(solcub(2)-x1(i)) abs(solcub(3)-x1(i))]);
26
27    xres = solcub(ind(1));
28    yres = parabole(x1(i),co);
29    x1(i);
30    y1(i);
31
32    dist(i) = sqrt((x1(i)-xres)^2+(y1(i)-yres)^2);
33end
34
35dist;
36
37rmsFit = std(dist);
Note: See TracBrowser for help on using the repository browser.