Last change
on this file since 4 was
4,
checked in by zhangj, 11 years ago
|
Initial import--MML version from SOLEIL@2013
|
File size:
1.1 KB
|
Line | |
---|
1 | function QuadSP = finddispquad |
---|
2 | %FINDDISPQUAD - Find the optimal setting for the dispersion correction quadrupole family |
---|
3 | % QuadSP = finddispquad |
---|
4 | % |
---|
5 | % This function is under development |
---|
6 | |
---|
7 | |
---|
8 | disp('This function is under construction (Greg Portmann). '); |
---|
9 | return |
---|
10 | |
---|
11 | QuadSP0 = getsp('QFA'); |
---|
12 | |
---|
13 | % Get Dispersion |
---|
14 | %[Dx,Dy] = getdisp; |
---|
15 | |
---|
16 | |
---|
17 | i = 0; |
---|
18 | for qfa=[0 .2 .4 .6 .8 1 1.2 1.4 1.6 1.8 2] |
---|
19 | i = i+1; |
---|
20 | QFAnew = QuadSP0+qfa |
---|
21 | qfaam=setsp('QFA', QFAnew); |
---|
22 | sleep(2); |
---|
23 | [Dx(:,i),Dy(:,i)]=getdisp; |
---|
24 | x(:,i) = getx(1,BPMelem1278); |
---|
25 | QFA(:,i) = getsp('QFA'); |
---|
26 | save qfaout x QFA Dx Dy |
---|
27 | end |
---|
28 | |
---|
29 | |
---|
30 | % Set QFA back to starting point |
---|
31 | setsp('QFA', QuadSP0); |
---|
32 | |
---|
33 | |
---|
34 | % Find LS fit to the line |
---|
35 | %y=Dxmat; |
---|
36 | %X = [ones(max(size()),1) QFA']; |
---|
37 | %b = inv(X'*X)*X'*y; |
---|
38 | %QuadSP = -b(1)/b(2); |
---|
39 | |
---|
40 | %QFA1 = linspace(QFA(1),QFA(max(size(QFA))),100); |
---|
41 | %yfit = b(1) + b(2)*QFA1; |
---|
42 | |
---|
43 | %figure |
---|
44 | %plot(QFA1,yfit, QFA,y,'o'); grid on |
---|
45 | %xlabel('RF Frequency [MHz]'); |
---|
46 | %ylabel('Dot product of Dx and Hor. Orbit'); |
---|
47 | |
---|
48 | %fprintf('\n\n Zero crossing of QFAF = %f [MHz]\n', rf0); |
---|
49 | |
---|
50 | save qfadata |
---|
51 | |
---|
52 | figure; |
---|
53 | plot(QFA,Dx(BPMelem1278,:)); grid on |
---|
54 | xlabel('QFA [Amps]'); |
---|
55 | ylabel('Dispersion'); |
---|
56 | |
---|
Note: See
TracBrowser
for help on using the repository browser.