1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <title>Description of findrespmdemo</title> |
---|
6 | <meta name="keywords" content="findrespmdemo"> |
---|
7 | <meta name="description" content="FINDRESPMDEMO response matrix demo"> |
---|
8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
9 | <meta name="generator" content="m2html © 2003 Guillaume Flandin"> |
---|
10 | <meta name="robots" content="index, follow"> |
---|
11 | <link type="text/css" rel="stylesheet" href="../../m2html.css"> |
---|
12 | </head> |
---|
13 | <body> |
---|
14 | <a name="_top"></a> |
---|
15 | <div><a href="../../index.html">Home</a> > <a href="../index.html">at</a> > <a href="index.html">atdemos</a> > findrespmdemo.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for at/atdemos <img alt=">" border="0" src="../../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>findrespmdemo |
---|
21 | </h1> |
---|
22 | |
---|
23 | <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2> |
---|
24 | <div class="box"><strong>FINDRESPMDEMO response matrix demo</strong></div> |
---|
25 | |
---|
26 | <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2> |
---|
27 | <div class="box"><strong>This is a script file. </strong></div> |
---|
28 | |
---|
29 | <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2> |
---|
30 | <div class="fragment"><pre class="comment">FINDRESPMDEMO response matrix demo |
---|
31 | This script illustrates the use of AT function FINDRESPM</pre></div> |
---|
32 | |
---|
33 | <!-- crossreference --> |
---|
34 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2> |
---|
35 | This function calls: |
---|
36 | <ul style="list-style-image:url(../../matlabicon.gif)"> |
---|
37 | <li><a href="spear2.html" class="code" title="function spear2">spear2</a> SPEAR2 example lattice definition file</li></ul> |
---|
38 | This function is called by: |
---|
39 | <ul style="list-style-image:url(../../matlabicon.gif)"> |
---|
40 | </ul> |
---|
41 | <!-- crossreference --> |
---|
42 | |
---|
43 | |
---|
44 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2> |
---|
45 | <div class="fragment"><pre>0001 <span class="comment">%FINDRESPMDEMO response matrix demo</span> |
---|
46 | 0002 <span class="comment">% This script illustrates the use of AT function FINDRESPM</span> |
---|
47 | 0003 |
---|
48 | 0004 <a href="spear2.html" class="code" title="function spear2">spear2</a> |
---|
49 | 0005 <span class="comment">% The most common RM is corrector-to-BPM</span> |
---|
50 | 0006 <span class="comment">% In this demonstration we will not use the actual correctors</span> |
---|
51 | 0007 <span class="comment">% to keep the lattice simple.</span> |
---|
52 | 0008 |
---|
53 | 0009 <span class="comment">% We will use all focusing quadrupoles as correctors:</span> |
---|
54 | 0010 <span class="comment">% In order to do this we need to use StrMPolesymplectic4 pass-method</span> |
---|
55 | 0011 <span class="comment">% for them. This mehod looks at all terms of the polynomial</span> |
---|
56 | 0012 <span class="comment">% expansion of transverse magnetic field.</span> |
---|
57 | 0013 <span class="comment">% (QuadLinearPass only looks at field 'K')</span> |
---|
58 | 0014 <span class="comment">% PolynomB(1) gives horizontal kick</span> |
---|
59 | 0015 <span class="comment">% PolynomA(1) gives a vertical kick</span> |
---|
60 | 0016 |
---|
61 | 0017 <span class="comment">% Find indexes of elements that belong to QF Q1 Q2 Q3 families</span> |
---|
62 | 0018 <span class="comment">% We will use them as corrector elements</span> |
---|
63 | 0019 QFI = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'QF'</span>); |
---|
64 | 0020 Q1I = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'Q1'</span>); |
---|
65 | 0021 Q2I = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'Q2'</span>); |
---|
66 | 0022 Q3I = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'Q3'</span>); |
---|
67 | 0023 CORRINDEX = sort([ QFI Q1I Q2I Q3I]); |
---|
68 | 0024 <span class="comment">% Install the new pass-method 'StrMPoleSymplectic4Pass'</span> |
---|
69 | 0025 THERING = setcellstruct(THERING,<span class="string">'PassMethod'</span>,CORRINDEX,<span class="string">'StrMPoleSymplectic4Pass'</span>); |
---|
70 | 0026 |
---|
71 | 0027 <span class="comment">% We will use etrance points of all bending magnets as observation points (BPMs)</span> |
---|
72 | 0028 BPMINDEX = findcells(THERING,<span class="string">'BendingAngle'</span>); |
---|
73 | 0029 |
---|
74 | 0030 NBPM = length(BPMINDEX); |
---|
75 | 0031 NCOR = length(CORRINDEX); |
---|
76 | 0032 |
---|
77 | 0033 <span class="comment">% Prepare input parameters for FINDRESPM that will tell it, which</span> |
---|
78 | 0034 <span class="comment">% parameters to use as orbit perturbations</span> |
---|
79 | 0035 <span class="comment">% See help for FINDRESPM</span> |
---|
80 | 0036 |
---|
81 | 0037 <span class="comment">% Set the size of a parameter change for numeric differentiation</span> |
---|
82 | 0038 KICKSIZE = 1e-5; |
---|
83 | 0039 |
---|
84 | 0040 RX = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomB'</span>,1,1); |
---|
85 | 0041 RY = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomA'</span>,1,1); |
---|
86 | 0042 <span class="comment">% Build the response matrix</span> |
---|
87 | 0043 <span class="comment">% In the form</span> |
---|
88 | 0044 <span class="comment">%</span> |
---|
89 | 0045 <span class="comment">% | HH HV |</span> |
---|
90 | 0046 <span class="comment">% | VH VV |</span> |
---|
91 | 0047 <span class="comment">%</span> |
---|
92 | 0048 <span class="comment">% HH - Horizontal BPM response to horizontal orbit kicks</span> |
---|
93 | 0049 <span class="comment">% HV - Horizontal BPM response to vertical orbit kicks</span> |
---|
94 | 0050 <span class="comment">% VH - vertical BPM response to horizontal orbit kicks</span> |
---|
95 | 0051 <span class="comment">% VV - vertical BPM response to vertical orbit kicks</span> |
---|
96 | 0052 RespM_XY = [RX{1} RY{1}; RX{3} RY{3}]; |
---|
97 | 0053 figure(1); |
---|
98 | 0054 mesh(RespM_XY); |
---|
99 | 0055 colormap(<span class="string">'copper'</span>); |
---|
100 | 0056 xlabel(<span class="string">'Corrector Number'</span>) |
---|
101 | 0057 ylabel(<span class="string">'BPM Number'</span>); |
---|
102 | 0058 zlabel(<span class="string">'Normalized Orbit Response'</span>); |
---|
103 | 0059 title(<span class="string">'Orbit Response Matrix - uncoupled lattice'</span>) |
---|
104 | 0060 |
---|
105 | 0061 <span class="comment">% Now we wish to introduce coupling:</span> |
---|
106 | 0062 QDI = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'QD'</span>); |
---|
107 | 0063 <span class="comment">% Generate random rotations:</span> |
---|
108 | 0064 QDTILTS = 1*(pi/180)*randn(1,length(QDI)); |
---|
109 | 0065 <span class="comment">% Put random values in the ring</span> |
---|
110 | 0066 settilt(QDI,QDTILTS); |
---|
111 | 0067 |
---|
112 | 0068 <span class="comment">% Generate the new response matrix for the lattice with errors</span> |
---|
113 | 0069 RX = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomB'</span>,1,1); |
---|
114 | 0070 RY = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomA'</span>,1,1); |
---|
115 | 0071 |
---|
116 | 0072 RespM_XY_Coupled = [RX{1} RY{1}; RX{3} RY{3}]; |
---|
117 | 0073 figure(2); |
---|
118 | 0074 mesh(RespM_XY_Coupled); |
---|
119 | 0075 colormap(<span class="string">'copper'</span>); |
---|
120 | 0076 title(<span class="string">'Orbit Response Matrix - coupled lattice'</span>) |
---|
121 | 0077 xlabel(<span class="string">'Corrector Number'</span>) |
---|
122 | 0078 ylabel(<span class="string">'BPM Number'</span>); |
---|
123 | 0079 zlabel(<span class="string">'Normalized Orbit Response'</span>); |
---|
124 | 0080</pre></div> |
---|
125 | <hr><address>Generated on Mon 21-May-2007 15:26:45 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address> |
---|
126 | </body> |
---|
127 | </html> |
---|