-
Notifications
You must be signed in to change notification settings - Fork 0
/
PointToPointFocusing.html
88 lines (85 loc) · 27.6 KB
/
PointToPointFocusing.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge,IE=9,chrome=1"><meta name="generator" content="MATLAB 2021a"><title>Point-to-point focusing (Section 3.6.3)</title><style type="text/css">.rtcContent { padding: 30px; } .S0 { margin: 2px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left; }
.S1 { margin: 15px 10px 5px 4px; padding: 0px; line-height: 28.8px; min-height: 0px; white-space: pre-wrap; color: rgb(213, 80, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 24px; font-weight: normal; text-align: left; }
.CodeBlock { background-color: #F7F7F7; margin: 10px 0 10px 0;}
.S2 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 1px solid rgb(233, 233, 233); border-bottom: 0px none rgb(0, 0, 0); border-radius: 4px 4px 0px 0px; padding: 6px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; }
.S3 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 0px none rgb(0, 0, 0); border-radius: 0px; padding: 0px 45px 0px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; }
.S4 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; }
.S5 { color: rgb(64, 64, 64); padding: 10px 0px 6px 17px; background: rgb(255, 255, 255) none repeat scroll 0% 0% / auto padding-box border-box; font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; overflow-x: hidden; line-height: 17.234px; }
.variableValue { width: 100% !important; }
.embeddedOutputsMatrixElement,.eoOutputWrapper .matrixElement { min-height: 18px; box-sizing: border-box;}
.embeddedOutputsMatrixElement .matrixElement,.eoOutputWrapper .matrixElement,.rtcDataTipElement .matrixElement { position: relative;}
.matrixElement .variableValue,.rtcDataTipElement .matrixElement .variableValue { white-space: pre; display: inline-block; vertical-align: top; overflow: hidden;}
.embeddedOutputsMatrixElement.inlineElement {}
.embeddedOutputsMatrixElement.inlineElement .topHeaderWrapper { display: none;}
.embeddedOutputsMatrixElement.inlineElement .veTable .body { padding-top: 0 !important; max-height: 100px;}
.inlineElement .matrixElement { max-height: 300px;}
.embeddedOutputsMatrixElement.rightPaneElement {}
.rightPaneElement .matrixElement,.rtcDataTipElement .matrixElement { overflow: hidden; padding-left: 9px;}
.rightPaneElement .matrixElement { margin-bottom: -1px;}
.embeddedOutputsMatrixElement .matrixElement .valueContainer,.eoOutputWrapper .matrixElement .valueContainer,.rtcDataTipElement .matrixElement .valueContainer { white-space: nowrap; margin-bottom: 3px;}
.embeddedOutputsMatrixElement .matrixElement .valueContainer .horizontalEllipsis.hide,.embeddedOutputsMatrixElement .matrixElement .verticalEllipsis.hide,.eoOutputWrapper .matrixElement .valueContainer .horizontalEllipsis.hide,.eoOutputWrapper .matrixElement .verticalEllipsis.hide,.rtcDataTipElement .matrixElement .valueContainer .horizontalEllipsis.hide,.rtcDataTipElement .matrixElement .verticalEllipsis.hide { display: none;}
.embeddedOutputsVariableMatrixElement .matrixElement .valueContainer.hideEllipses .verticalEllipsis, .embeddedOutputsVariableMatrixElement .matrixElement .valueContainer.hideEllipses .horizontalEllipsis { display:none;}
.embeddedOutputsMatrixElement .matrixElement .valueContainer .horizontalEllipsis,.eoOutputWrapper .matrixElement .valueContainer .horizontalEllipsis { margin-bottom: -3px;}
.eoOutputWrapper .embeddedOutputsVariableMatrixElement .matrixElement .valueContainer { cursor: default !important;}
.embeddedOutputsVariableElement { white-space: pre-wrap; word-wrap: break-word; min-height: 18px; max-height: 250px; overflow: auto;}
.variableElement {}
.embeddedOutputsVariableElement.inlineElement {}
.inlineElement .variableElement {}
.embeddedOutputsVariableElement.rightPaneElement { min-height: 16px;}
.rightPaneElement .variableElement { padding-top: 2px; padding-left: 9px;}
.variableNameElement { margin-bottom: 3px; display: inline-block;}
/* * Ellipses as base64 for HTML export. */.matrixElement .horizontalEllipsis,.rtcDataTipElement .matrixElement .horizontalEllipsis { display: inline-block; margin-top: 3px; /* base64 encoded version of images-liveeditor/HEllipsis.png */ width: 30px; height: 12px; background-repeat: no-repeat; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB0AAAAJCAYAAADO1CeCAAAAJUlEQVR42mP4//8/A70xw0i29BUDFPxnAEtTW37wWDqakIa4pQDvOOG89lHX2gAAAABJRU5ErkJggg==");}
.matrixElement .verticalEllipsis,.textElement .verticalEllipsis,.rtcDataTipElement .matrixElement .verticalEllipsis,.rtcDataTipElement .textElement .verticalEllipsis { margin-left: 35px; /* base64 encoded version of images-liveeditor/VEllipsis.png */ width: 12px; height: 30px; background-repeat: no-repeat; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAZCAYAAAAIcL+IAAAALklEQVR42mP4//8/AzGYgWyFMECMwv8QddRS+P//KyimlmcGUOFoOI6GI/UVAgDnd8Dd4+NCwgAAAABJRU5ErkJggg==");}
.S6 { margin: 10px 10px 9px 4px; padding: 0px; line-height: 21px; min-height: 0px; white-space: pre-wrap; color: rgb(0, 0, 0); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 14px; font-weight: normal; text-align: left; }
.S7 { margin: 3px 10px 5px 4px; padding: 0px; line-height: 20px; min-height: 0px; white-space: pre-wrap; color: rgb(60, 60, 60); font-family: Helvetica, Arial, sans-serif; font-style: normal; font-size: 20px; font-weight: bold; text-align: left; }
.S8 { border-left: 1px solid rgb(233, 233, 233); border-right: 1px solid rgb(233, 233, 233); border-top: 0px none rgb(0, 0, 0); border-bottom: 1px solid rgb(233, 233, 233); border-radius: 0px 0px 4px 4px; padding: 0px 45px 4px 13px; line-height: 17.234px; min-height: 18px; white-space: nowrap; color: rgb(0, 0, 0); font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 14px; }</style></head><body><div class = rtcContent><div class = 'S0'><span>Companion software for "Volker Ziemann, </span><span style=' font-style: italic;'>Hands-on Accelerator physics using MATLAB, CRCPress, 2019</span><span>" (https://www.crcpress.com/9781138589940)</span></div><h1 class = 'S1'><span>Point-to-point focusing (Section 3.6.3)</span></h1><div class = 'S0'><span>Volker Ziemann, 211119</span></div><div class = 'S0'><span>In this example we verify the iamging equation for a lens </span><span texencoding="\frac{1}{b}+\frac{1}{g}=\frac{1}{f}" style="vertical-align:-15px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABGCAYAAAAEj5xiAAAH0UlEQVR4Xu2dBcgtRRTHf3a3gt2NiQp2i93dAXYHihgoitjdYnehYgsmiomBrajY3d3yk1m9774bu3f33m937xx4PD7u1DnznzPnnDkzOwaRhloCYww195F5IgCGHAQRABEAQy6BIWc/aoAIgCGXwJCzn1YDjAPsCOwHzF9RmdWBh3ainwo4EJgd2CLL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MeU3O8VipqrmQSImsxsJw+3jGhWkczYfj1saWYA90R1BIB+v7aMz6a1I7cHM2fVEJ5qVoEErmH3hHTVBbq8Jq+EZeajjgDQ5/czd+73iUfTLBiTJrUJPMY2F6DsZFa2ZxcatXvDv8a7/r/hbG2AnqmOAPBbesb9vWm0VciRSwRkJNDQqWnSfmAxuY3UswAHVFFNZSjbk1mNdD8UKW+exZi13TPVEQAKw8csnWiNPkPZnm3o/3vOIThMka5SKpjut5lM5i0Y7HHS/WKo/n8uqisAcgllmCpHAAzTbLfgNQJgyAHwD2ylk1ZJe3M9AAAAAElFTkSuQmCC" width="64" height="35" /></span><span>, where </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">b</span><span> and </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">g</span><span> are the distance between the source and the image plane and the lens , respectively. </span></div><div class = 'S0'><span>We select </span><span texencoding="g=1\," style="vertical-align:-5px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE0AAAAkCAYAAADM8rciAAACz0lEQVRoQ+3ZX+iOZxzH8Rci5URKcWBJlCITKZty4M8BkabNRChNobVswoEocbQJG7amltVG/qSQhEIrhXIiqxWTNHEyf5K/UfTV9au7p9/P87ufp9v99Pvd99nT872u63O97+/1/XPdPVRPbgI9co+oBqigNeAEFbQKWgMEGhhSeVoFrQECDQzpzp42HZvwDa7kYdcdoU1NsCYlUBNxuYLWPoFRWIY3mIuPKmj1XaU3XiWzNfi+glYfWtZiCX6voLUgtCGYgvEpJlzFPrzMp7VlrAv1tIgDq7ERv+InDMQpPMZ8PMRNvG4ZJPWFFAotzn0ssB3fZbT8guWZ30Nxu75Ws3GoE3b1TBbjcD2j9/xfGLS2iR8hjueTjIj12IKzmJZD/BwczWHfkWl4+MEm5ikM2nWMwI9YVSPwZ6zALQxrQnxZQwuB1j/FqtjUUuyt2d0FREUdXvNZWTtvYt1CoA3A/SQqsub5jMCR+Cf9XoQ/mxBf1tBCoMVmrmE05mWCbs/kXRHQ92NhWbtuct3CoI3FSdxNvVpfrE3ZdGtqel/kFN/ls2fwmIw9OI0+iKI2MuaNnLDazLt89oyMGR41E2cahNSqwwo5nr3wLHnXJezACTxtVQo5da3E7jTmU1zMM/59l5AH8GVmsucpxu3EX3kWaUHb47zrTuL5Cr/l0dgRtC9SZoz6LN5EVOBtl3Yxf9xFrcuzUAvYDk5FenQw4zJ64vREd/EvtnXmEqIWWpQUu1Lb9HlmgrCLem0zPkkLxrXxuRaA8cEl1EL7OsWvQfi/HTUB9RhmYUPqPz+46LIXrIUWddmEdP3TkbY4unFTEZ54pOwNlLF+LbSoyeLjQ8Sv/zoQ9EOKcWMy/WkZ2ktbsxbax6nP/BsLcCejLDqCSNXfYgbCpls+7WXP4QlOBP57eJDqs34J6B+dyTBdmWZ3/Fjc9PusoDWAsILWALS3AmeJJbh0I74AAAAASUVORK5CYII=" width="38.5" height="18" /></span><span>m and </span><span texencoding="b=2\," style="vertical-align:-5px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAE0AAAAkCAYAAADM8rciAAADh0lEQVRoQ+3YeeilUxzH8dfYxhrNoGQLDeMP05QlkSxlSZZChshYmhkiS2RJdtn+oqzJ/oc9WwrZspblD8lSClkiW7ZkS/rU+Um357nPcx+/+t07nlO3+8f5nu/5Pu/zPd/lzNKPkQnMGnlFv0APrYMT9NB6aB0IdFjSe9o0Q1sbW5bfVtgER3fYY7lbMszTjsTOWIzV8AJ2nXACe+I4LMDGeB9v4lJ81vbb2lzPKI6nXYQL2yoeM7kVcB2Or7HrpwLz/jZ2N0FbEz8gm+6Cl9ooHUOZ03E5bsZz+AXzsaT8x+SfsQ0+brK/Cdp+eAw/Yi7+bFI4hvO5hu/hYDw5YN/KuLvMZeqmId74z9ImaNfgZDyEg8YQSBuTTsGGOLNGeL3iXavjDWzfpLQJWk4obpxYkFOYxPFgsf/rIca/VmB9jo2aPnIYtLj1J0XB5vgIK2KPUoZ8iWfwfdMmMzyfePxXgw0Bm5v0SqkYhooPg3YsbsEHBdJOuLVk0imlAXcAXp9hMP91+5eR70t1kCqhM7R7sAjXIqn4KpyHV7Edcjpz8Hape5r2yvz+uK+NYIPMUcWmaVBlNnL4a2ALfNqktM7T4tJflYy5rLjuoSWLTum88l/BdV1827QZDsTDLeSaRA7DvU1CLecPKQdwMS5os6YO2rYlk/xR0vQJFRVzksMNZZOc0IdtNhwzmcToJIH874Df29hXB+0cXFYUBNiNFcrSepxbguyqCOBJG2fgVOw4HW1UqubdkDSdRv3XChpPYO9SYSejTtpIh/MA9sJboxhf5WkJiN9hFVyC8ysUblACZtz6GNw+yqZjIDsPT+PwUmaMZFIVtH3xeLlum+KLCo1X4Cy8g4UjtFfjkD1TvD6Fk/DsSLSKcBW0q5HWI815XHhwJOgHVjLs7kiN03bMdPZcvxTkZxfHqLJ7JeQtsbYaqIL2LrbG9ThxQGtqmudL4FxaXg3aAptpudSUuZJJcIlldSN1acqZF+sEBqHFdaeKu8GsmRh3G1KvpXZLdzApY63iYXGIu2qMzkNrQlNuT5ymdgxCS4efuiUjbVQgZeSd6Q7EdQMsXcGkjLxeJNNXhZqqbzgNCVGtoUVwHxyBzcoD5Dr4BnfikRGC/rhAfbS0b23s+a08Iw3tbpqehtps9L+T6aF1OPIeWg+tA4EOS3pP66F1INBhSe9pPbQOBDos6T2tA7S/AehylCXwFhPLAAAAAElFTkSuQmCC" width="38.5" height="18" /></span><span>m and then try to determine the focal length </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">f</span><span> of the lens that images the start of the </span><span style=' font-family: monospace;'>beamline</span><span> to its end, which implies that ant ray starting with an angle must cross the optical axis at the end. And this implies that the transfer matrix element that correlates the angle at the start (second index=2) to the position at the end (first index=1), must be zero, or </span><span texencoding="R_{12}=0" style="vertical-align:-6px"><img src="data:image/png;base64,iVBOR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S3XDHUFS6a8GSJahsvG5sMXNntEeMsSsAXwCLA182ZeEK+6YUdTOgjJhslfTU9gUuqQKCmf6FGKhxNskpdFg08XzsSfAUF4m1gznDhp9zikCQ+toEfC4W8AD4TNbhifHkVJW62dESSfFqMaZnFEnWP/K3RfO9tTJP0LDZgkUVsAnZzqrNq9eBJftYKWt95EGYDDglcelsmezlbkhCYhUg6mZH6pQxSJP0hiVK2nuzB/cG4LsNkDIQLMC8R1AMDZlXpJPvAmxI9RqTjS8Dwb77VMG00rWnAX4ALgL2r2L9BscYXtTTDrOd5DxV9/2+ATxwkp0rqoBg69rLGidZGxjL03yQrbEN4ElVTOI79DBEGQhlU2x9SIU3Tyr2Bu3cc+uJACm8pMIcYQMzlcMjXOsNJuhBlztFnpB2Tb1HsDVRBMLkcZM2QxRzK5Z4jAoNFQRfxgsiWdmfbbV+otecgJHBosyDY0GmmEu95LKStgXk4R4kKQiGHS8fshCTDX4nSu1jCuZfCOwXz2Ux8maRz8tQQNADbfna9HpvPAAgU1ESsncQClmj+dJ+mjaxNjCqFEq/Bt5w2WAoINgOFvhrh2vztq/TNhDk2oY1Kd0EI20CwcRmYZd1bTsQhtkC/cKR3Nlix89F0kQsVbV14h3uqJW6PCFr+hX1V+aJ75a8lbJFkoltczuU8vCnRy0C8e3QSL6ffN9ia5+oN/xIzGs+P4aynWFr3IaedxZFUlhhjqTCTaxdlyc08W7jzZ4dCC2AqgOhA6EFFmiBCp0ndCC0wAItUKHzhBaA8C+RpwY4MZKsKAAAAABJRU5ErkJggg==" width="48.5" height="20" /></span><span>. This is the point-to-point imaging condition.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S2'><span style="white-space: pre"><span >clear </span><span style="color: rgb(170, 4, 249);">all</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span >addpath </span><span style="color: rgb(170, 4, 249);">./2D</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">global </span><span >beamline </span><span style="color: rgb(2, 128, 9);">% make available in chisq_R12() function</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span >beamline=[1, 1, 1, 0; </span><span style="color: rgb(2, 128, 9);">% g</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span > 2, 1, 0, 3; </span><span style="color: rgb(2, 128, 9);">% f</span></span></div></div><div class="inlineWrapper outputs"><div class = 'S4'><span style="white-space: pre"><span > 1, 1, 2, 0] </span><span style="color: rgb(2, 128, 9);">% b </span></span></div><div class = 'S5'><div class="inlineElement eoOutputWrapper embeddedOutputsVariableMatrixElement" uid="03251AAC" data-scroll-top="null" data-scroll-left="null" data-width="1143" data-testid="output_0" style="width: 1173px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="matrixElement veSpecifier" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="veVariableName variableNameElement double" style="width: 1143px; white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="headerElementClickToInteract" style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><span style="white-space: normal; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;">beamline = </span><span class="veVariableValueSummary veMetaSummary" style="white-space: normal; font-style: normal; color: rgb(179, 179, 179); font-size: 12px;">3×4</span></div></div><div class="valueContainer" data-layout="{"columnWidth":44,"totalColumns":4,"totalRows":3,"charsPerColumn":6}" style="white-space: nowrap; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"><div class="variableValue" style="width: 178px; white-space: pre; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"> 1 1 1 0
2 1 0 3
1 1 2 0
</div><div class="horizontalEllipsis hide" style="white-space: nowrap; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"></div><div class="verticalEllipsis hide" style="white-space: nowrap; font-style: normal; color: rgb(64, 64, 64); font-size: 12px;"></div></div></div></div></div></div></div><div class = 'S6'><span>Having defined the beamline, we employ </span><span style=' font-family: monospace;'>fminsearch()</span><span> to find a focal length </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">f</span><span> that makes the </span><span texencoding="R_{12}" style="vertical-align:-6px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAoCAYAAACFFRgXAAADUElEQVRYR+3Yaah9UxzG8c8/8zyUIYUMpUyZEpklRRle4W9IvDBEMocy80KUDBlCmQpRIqIoMhNeCJGhSBmTeRY9/35H22nvu8/tds69/zrr1T57r732dz9rref37LPIUtYWLWW8psDjnrGpwlOFhxSYaUksh1uxHzYcuu+3+v0VPsFzuBFfLASF18NnWLZgzsc1LHGYnXE9dsDvOAYPjhN6lE23Br4riF+wdsENuNbFe1gLUX47vD8u6FGA98KzBfAkDmiBuR+H1/nTcd18Al+MSwrgTFzbAhPA0+r8TThlPoFfwG4FsA3eboF5BnsvBIVXw7e14T7HBi2wm+MtrISfsRm+nC+FD8Yj9fC7cewQSDbcU9gW/+B43Dku2Izbt+luwKkFcBFuw+rYFPvUWl0FH+MMPDpO2FGAY1dblHrx2RUbQN/jHjyBp/HHuGH7gFPdPi2IbLw9St0PsQ5+wPr4dRKgg2fMtCSyHu+ojrG1S+u4aWGLEQ+eWJsJ+D4cUSS748U6Thl+o467CsnwC6T6XVkv/VqH01yNXetannVO7Y3/de8CzvlYU6b+pyrHfzbujI3Fk/+uYBTLa2ub4Cici1jkLnh1qOPGeBmPVQTYFzvia2yJb5r9u4C3x5vVMQMdNPSQsyoA5XRgok5bizdnjScs5Z424NhlAtTrNUCYcu5oxJkuHwU4EFdVx7ZskM2WBLcM3sHWPYt4UN6HgZfHFfXSzSG2qor6QGNZLrnepXCKQXJwWqZnoHZz0MdxYE+fQf8u4ETWlctxmmOvih9xC07uUzhxMsE8bx/vzdprrt/B/YchCqRlgx45g8pdwF23pLzHPg9tVNpOhZvpLDk45bcNeIX6wlizCstOHTORB80WOGkvHwNxp7+6FM7UX9aY5kG/D/AQLmiR42acVOezm+/C2S39ZgOcmX2p8vVHw2P1ZYmevTTy5dkAp0BFpHvbRl9owIcgS+vCLikWEnCqXIrMIB22Mi8U4PjueThuaJPF3hIPbh/QTwp4EJj2xPND0m1U/2s8XDFgcDlRdn+ciFcmBRw/jfGfUH6eP1yS7vJVkpKdj4GEoWTutvYuov5/bVIKj2wnfR2nwH0KzfX6VOG5Kth3/1ThPoXmev1fiI6nKVYOHs4AAAAASUVORK5CYII=" width="22" height="20" /></span><span> zero, a constraint that we encode in the function </span><span style=' font-family: monospace;'>chisq_R12()</span><span> that is defined in the Appendix. </span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S2'><span style="white-space: pre"><span >f0=3; </span><span style="color: rgb(2, 128, 9);">% starting guess</span></span></div></div><div class="inlineWrapper outputs"><div class = 'S4'><span style="white-space: pre"><span >[f,fval]=fminsearch(@chisq_R12,f0)</span></span></div><div class = 'S5'><div class='variableElement' style='font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; '>f = 0.6667</div><div class='variableElement' style='font-family: Menlo, Monaco, Consolas, "Courier New", monospace; font-size: 12px; '>fval = 5.3647e-09</div></div></div></div><div class = 'S6'><span>Here fminsearch() finds that </span><span texencoding="f=2/3" style="vertical-align:-5px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAG0AAAAmCAYAAADOZxX5AAAFtklEQVR4Xu2adch0VRCHn8/uQOzALsRuxADF7kQU8w8DFbsFsbs+A7sbRTGwxcIubEVsbAywi0dn5X67d/c9d+/dfXdf7vzzvuw9Z86cM2dmfjNzxlHT0J3AuKGTuBaYWmlDeAlqpdVKG8IT6K3I2wNbAVtUuUxtaVWeZiuvJ4CHgWOqXKYKpcljQ2BtYKoQ8ibg7yoFHUJe8wPvAYsC71Qpf1mlqaSbgemAvYDNgOOAg4AzqhS0h7wWBA4Flo4D/gR4FTgHeKrEulrXBsDKbXjMABwOrAksB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yHdKPNw/3oP97VfB1ms9C8SiW/zMK3LKohKbTngLva3LPBC9NpOzptfRGlWBWydix5nBP7sQqBBm2J7xDaKTdC/coSbJJJ+OwEWybWoZrouqkKGjZFIfqZKxk+bxM3phH29h6JmaQPV4nELFVGazcBTorfkzRt2ssFp7TSF7oiufPNYy3kCj02BBxMYWbFpeKjfgUuj1mjXWjBjUi56tZHcttZZRGk2Ak32TDqvShBwkIdk+2UpcrbrbWldPg+wPZVnqc28PW/X3iVKXcZDy1VWc/RixsSWvCyPSYrQjvk4AqMlntyWQSqjMTTO5FvLabRw+rK1VEuzBW4H106qt66m/54SeJFNhn0I1DdqpzQRYtbcRVZm+lZEnu+bdIO9kNa1Q8WdhaQd5ylNaOsjS3MXG4GOMT+zn5ZbwExaaewN8rmbRQbRYF8pT2kWPX1GYOHSftK+gM+bfaH0fV+lG9zF7P1ZELCyn5cG9FTyPKWZS9hm98WwQVZFiXhSH7b0VOABYe77EWOZr9H6TqlApO+CDfiCd0YlJe8ZXM9Fr5XW8yOufoFaadWfac851krr+RFXv0CttOrPtOcc/wGWrgA28hSyjwAAAABJRU5ErkJggg==" width="54.5" height="19" /></span><span>m which indeed satisfies the imaging conditions. </span></div><h2 class = 'S7'><span>Appendix</span></h2><div class = 'S0'><span>the function chisq_R12() receives teh focal length </span><span style="font-family: STIXGeneral, STIXGeneral-webfont, serif; font-style: italic; font-weight: normal; color: rgb(0, 0, 0);">f</span><span> as input and returns the squared </span><span texencoding="R_{12}" style="vertical-align:-6px"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAoCAYAAACFFRgXAAADUElEQVRYR+3Yaah9UxzG8c8/8zyUIYUMpUyZEpklRRle4W9IvDBEMocy80KUDBlCmQpRIqIoMhNeCJGhSBmTeRY9/35H22nvu8/tds69/zrr1T57r732dz9rref37LPIUtYWLWW8psDjnrGpwlOFhxSYaUksh1uxHzYcuu+3+v0VPsFzuBFfLASF18NnWLZgzsc1LHGYnXE9dsDvOAYPjhN6lE23Br4riF+wdsENuNbFe1gLUX47vD8u6FGA98KzBfAkDmiBuR+H1/nTcd18Al+MSwrgTFzbAhPA0+r8TThlPoFfwG4FsA3eboF5BnsvBIVXw7e14T7HBi2wm+MtrISfsRm+nC+FD8Yj9fC7cewQSDbcU9gW/+B43Dku2Izbt+luwKkFcBFuw+rYFPvUWl0FH+MMPDpO2FGAY1dblHrx2RUbQN/jHjyBp/HHuGH7gFPdPi2IbLw9St0PsQ5+wPr4dRKgg2fMtCSyHu+ojrG1S+u4aWGLEQ+eWJsJ+D4cUSS748U6Thl+o467CsnwC6T6XVkv/VqH01yNXetannVO7Y3/de8CzvlYU6b+pyrHfzbujI3Fk/+uYBTLa2ub4Cici1jkLnh1qOPGeBmPVQTYFzvia2yJb5r9u4C3x5vVMQMdNPSQsyoA5XRgok5bizdnjScs5Z424NhlAtTrNUCYcu5oxJkuHwU4EFdVx7ZskM2WBLcM3sHWPYt4UN6HgZfHFfXSzSG2qor6QGNZLrnepXCKQXJwWqZnoHZz0MdxYE+fQf8u4ETWlctxmmOvih9xC07uUzhxMsE8bx/vzdprrt/B/YchCqRlgx45g8pdwF23pLzHPg9tVNpOhZvpLDk45bcNeIX6wlizCstOHTORB80WOGkvHwNxp7+6FM7UX9aY5kG/D/AQLmiR42acVOezm+/C2S39ZgOcmX2p8vVHw2P1ZYmevTTy5dkAp0BFpHvbRl9owIcgS+vCLikWEnCqXIrMIB22Mi8U4PjueThuaJPF3hIPbh/QTwp4EJj2xPND0m1U/2s8XDFgcDlRdn+ciFcmBRw/jfGfUH6eP1yS7vJVkpKdj4GEoWTutvYuov5/bVIKj2wnfR2nwH0KzfX6VOG5Kth3/1ThPoXmev1fiI6nKVYOHs4AAAAASUVORK5CYII=" width="22" height="20" /></span><span>. Note that beamline(2,4) is the entry where the focal length of the lens is stored.</span></div><div class="CodeBlock"><div class="inlineWrapper"><div class = 'S2'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">function </span><span >chisq=chisq_R12(f)</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">global </span><span >beamline</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span >beamline(2,4)=f;</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span >[Racc,spos,nmat,nlines]=calcmat(beamline);</span></span></div></div><div class="inlineWrapper"><div class = 'S3'><span style="white-space: pre"><span >chisq=Racc(1,2,end)^2;</span></span></div></div><div class="inlineWrapper"><div class = 'S8'><span style="white-space: pre"><span style="color: rgb(14, 0, 255);">end</span></span></div></div></div>
<br>
<!--
##### SOURCE BEGIN #####
%%
% Companion software for "Volker Ziemann, _Hands-on Accelerator physics using
% MATLAB, CRCPress, 2019_" (https://www.crcpress.com/9781138589940)
%% Point-to-point focusing (Section 3.6.3)
% Volker Ziemann, 211119
%
% In this example we verify the iamging equation for a lens $\frac{1}{b}+\frac{1}{g}=\frac{1}{f}$,
% where $b$ and $g$ are the distance between the source and the image plane and
% the lens , respectively.
%
% We select $g=1\,$m and $b=2\,$m and then try to determine the focal length
% $f$ of the lens that images the start of the |beamline| to its end, which implies
% that ant ray starting with an angle must cross the optical axis at the end.
% And this implies that the transfer matrix element that correlates the angle
% at the start (second index=2) to the position at the end (first index=1), must
% be zero, or $R_{12}=0$. This is the point-to-point imaging condition.
clear all
addpath ./2D
global beamline % make available in chisq_R12() function
beamline=[1, 1, 1, 0; % g
2, 1, 0, 3; % f
1, 1, 2, 0] % b
%%
% Having defined the beamline, we employ |fminsearch()| to find a focal length
% $f$ that makes the $R_{12}$ zero, a constraint that we encode in the function
% |chisq_R12()| that is defined in the Appendix.
f0=3; % starting guess
[f,fval]=fminsearch(@chisq_R12,f0)
%%
% Here fminsearch() finds that $f=2/3$m which indeed satisfies the imaging conditions.
%% Appendix
% the function chisq_R12() receives teh focal length $f$ as input and returns
% the squared $R_{12}$. Note that beamline(2,4) is the entry where the focal length
% of the lens is stored.
function chisq=chisq_R12(f)
global beamline
beamline(2,4)=f;
[Racc,spos,nmat,nlines]=calcmat(beamline);
chisq=Racc(1,2,end)^2;
end
##### SOURCE END #####
-->
</div></body></html>