source: MML/trunk/at/doc_html/at/atdemos/findrespmdemo.html @ 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: 7.2 KB
Line 
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 &copy; 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> &gt;  <a href="../index.html">at</a> &gt; <a href="index.html">atdemos</a> &gt; findrespmdemo.m</div>
16
17<!--<table width="100%"><tr><td align="left"><a href="../../index.html"><img alt="<" border="0" src="../../left.png">&nbsp;Master index</a></td>
18<td align="right"><a href="index.html">Index for at/atdemos&nbsp;<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>
35This 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>
38This 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>
460002 <span class="comment">% This script illustrates the use of AT function FINDRESPM</span>
470003
480004 <a href="spear2.html" class="code" title="function spear2">spear2</a>
490005 <span class="comment">% The most common RM is corrector-to-BPM</span>
500006 <span class="comment">% In this demonstration we will not use the actual correctors</span>
510007 <span class="comment">% to keep the lattice simple.</span>
520008
530009 <span class="comment">% We will use all focusing quadrupoles as correctors:</span>
540010 <span class="comment">% In order to do this we need to use StrMPolesymplectic4 pass-method</span>
550011 <span class="comment">% for them. This mehod looks at all terms of the polynomial</span>
560012 <span class="comment">% expansion of transverse magnetic field.</span>
570013 <span class="comment">% (QuadLinearPass only looks at field 'K')</span>
580014 <span class="comment">% PolynomB(1) gives horizontal kick</span>
590015 <span class="comment">% PolynomA(1) gives a vertical kick</span>
600016
610017 <span class="comment">% Find indexes of elements that belong to QF Q1 Q2 Q3 families</span>
620018 <span class="comment">% We will use them as corrector elements</span>
630019 QFI = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'QF'</span>);
640020 Q1I = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'Q1'</span>);
650021 Q2I = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'Q2'</span>);
660022 Q3I = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'Q3'</span>);
670023 CORRINDEX = sort([ QFI Q1I Q2I Q3I]);
680024 <span class="comment">% Install the new pass-method 'StrMPoleSymplectic4Pass'</span>
690025 THERING = setcellstruct(THERING,<span class="string">'PassMethod'</span>,CORRINDEX,<span class="string">'StrMPoleSymplectic4Pass'</span>);
700026
710027 <span class="comment">% We will use etrance points of all bending magnets as observation points (BPMs)</span>
720028 BPMINDEX = findcells(THERING,<span class="string">'BendingAngle'</span>);
730029
740030 NBPM = length(BPMINDEX);
750031 NCOR = length(CORRINDEX);
760032
770033 <span class="comment">% Prepare input parameters for FINDRESPM that will tell it, which</span>
780034 <span class="comment">% parameters to use as orbit perturbations</span>
790035 <span class="comment">% See help for FINDRESPM</span>
800036
810037 <span class="comment">% Set the size of a parameter change for numeric differentiation</span>
820038 KICKSIZE = 1e-5;
830039
840040 RX = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomB'</span>,1,1);
850041 RY = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomA'</span>,1,1);
860042 <span class="comment">% Build the response matrix</span>
870043 <span class="comment">% In the form</span>
880044 <span class="comment">%</span>
890045 <span class="comment">% | HH HV |</span>
900046 <span class="comment">% | VH VV |</span>
910047 <span class="comment">%</span>
920048 <span class="comment">% HH - Horizontal BPM response to horizontal orbit kicks</span>
930049 <span class="comment">% HV - Horizontal BPM response to vertical orbit kicks</span>
940050 <span class="comment">% VH - vertical BPM response to horizontal orbit kicks</span>
950051 <span class="comment">% VV - vertical BPM response to vertical orbit kicks</span>
960052 RespM_XY = [RX{1} RY{1}; RX{3} RY{3}];
970053 figure(1);
980054 mesh(RespM_XY);
990055 colormap(<span class="string">'copper'</span>);
1000056 xlabel(<span class="string">'Corrector Number'</span>)
1010057 ylabel(<span class="string">'BPM Number'</span>);
1020058 zlabel(<span class="string">'Normalized Orbit Response'</span>);
1030059 title(<span class="string">'Orbit Response Matrix - uncoupled lattice'</span>)
1040060
1050061 <span class="comment">% Now we wish to introduce coupling:</span>
1060062 QDI = findcells(THERING,<span class="string">'FamName'</span>,<span class="string">'QD'</span>);
1070063 <span class="comment">% Generate random rotations:</span>
1080064 QDTILTS =   1*(pi/180)*randn(1,length(QDI));
1090065 <span class="comment">% Put random values in the ring</span>
1100066 settilt(QDI,QDTILTS);
1110067
1120068 <span class="comment">% Generate the new response matrix for the lattice with errors</span>
1130069 RX = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomB'</span>,1,1);
1140070 RY = findrespm(THERING,BPMINDEX ,CORRINDEX, KICKSIZE, <span class="string">'PolynomA'</span>,1,1);
1150071
1160072 RespM_XY_Coupled = [RX{1} RY{1}; RX{3} RY{3}];
1170073 figure(2);
1180074 mesh(RespM_XY_Coupled);
1190075 colormap(<span class="string">'copper'</span>);
1200076 title(<span class="string">'Orbit Response Matrix - coupled lattice'</span>)
1210077 xlabel(<span class="string">'Corrector Number'</span>)
1220078 ylabel(<span class="string">'BPM Number'</span>);
1230079 zlabel(<span class="string">'Normalized Orbit Response'</span>);
1240080</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> &copy; 2003</address>
126</body>
127</html>
Note: See TracBrowser for help on using the repository browser.