Permalink
Showing
with
307 additions
and 0 deletions.
- +37 −0 HW4/README.md
- +270 −0 HW4/collar_mass.svg
@@ -0,0 +1,37 @@ | ||
# Homework #3 | ||
## due 3/1/17 by 11:59pm | ||
|
||
|
||
1. Use your repository 'roots_and_optimization'. Document all the HW4 work under the | ||
heading `# Homework #4` in your `README.md` file | ||
|
||
a. Create a function called 'collar_potential_energy' that computes the total | ||
potential energy of a collar connected to a spring and sliding on a rod. As shown in | ||
the figure given a position, xc, and angle, theta: | ||
|
||
 | ||
|
||
The spring is unstretched when $x_{C}=0.5$. The potential energy due to gravity is: | ||
|
||
$PE_{g}=m x_{C}g\sin\theta$ | ||
|
||
where m=0.5 kg, and g is the acceleration due to gravity, | ||
|
||
and the potential energy due to the spring is: | ||
|
||
$PE_{s}=1/2K (\Delta L)^{2}$ | ||
|
||
where $\Delta L = 0.5 - \sqrt{0.5^{2}+(0.5-x_{C})^{2}}$ | ||
|
||
b. Use the `goldmin.m` function to solve for the minimum potential energy at xc when | ||
theta=0. *create an anonymous function with `@(x) collar_potential_energy(x,theta)` in | ||
the input for goldmin. Be sure to include the script that solves for xc* | ||
|
||
c. Create a for-loop that solves for the minimum potential energy position, xc, at a | ||
given angle, theta, for theta = 0..90 degrees. | ||
|
||
d. Include a plot of xc vs theta. `plot(theta,xc)` with | ||
|
||
`` | ||
|
||
3. Commit your changes to your repository. Sync your local repository with github. |
@@ -0,0 +1,270 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
|
||
<svg | ||
xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
xmlns:cc="http://creativecommons.org/ns#" | ||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
xmlns:svg="http://www.w3.org/2000/svg" | ||
xmlns="http://www.w3.org/2000/svg" | ||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
width="3in" | ||
height="2in" | ||
viewBox="0 0 270 180" | ||
id="svg4226" | ||
version="1.1" | ||
inkscape:version="0.91 r13725" | ||
sodipodi:docname="collar_mass.svg"> | ||
<defs | ||
id="defs4228"> | ||
<marker | ||
inkscape:stockid="Arrow2Mend" | ||
orient="auto" | ||
refY="0.0" | ||
refX="0.0" | ||
id="Arrow2Mend" | ||
style="overflow:visible;" | ||
inkscape:isstock="true"> | ||
<path | ||
id="path4186" | ||
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" | ||
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " | ||
transform="scale(0.6) rotate(180) translate(0,0)" /> | ||
</marker> | ||
<marker | ||
inkscape:stockid="Arrow1Mend" | ||
orient="auto" | ||
refY="0.0" | ||
refX="0.0" | ||
id="marker4761" | ||
style="overflow:visible;" | ||
inkscape:isstock="true"> | ||
<path | ||
id="path4763" | ||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " | ||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" | ||
transform="scale(0.4) rotate(180) translate(10,0)" /> | ||
</marker> | ||
<marker | ||
inkscape:isstock="true" | ||
style="overflow:visible;" | ||
id="marker4709" | ||
refX="0.0" | ||
refY="0.0" | ||
orient="auto" | ||
inkscape:stockid="Arrow1Mend"> | ||
<path | ||
transform="scale(0.4) rotate(180) translate(10,0)" | ||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" | ||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " | ||
id="path4711" /> | ||
</marker> | ||
<marker | ||
inkscape:isstock="true" | ||
style="overflow:visible;" | ||
id="marker4651" | ||
refX="0.0" | ||
refY="0.0" | ||
orient="auto" | ||
inkscape:stockid="Arrow1Mend"> | ||
<path | ||
transform="scale(0.4) rotate(180) translate(10,0)" | ||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" | ||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " | ||
id="path4653" /> | ||
</marker> | ||
<marker | ||
inkscape:isstock="true" | ||
style="overflow:visible;" | ||
id="marker4599" | ||
refX="0.0" | ||
refY="0.0" | ||
orient="auto" | ||
inkscape:stockid="Arrow1Mend"> | ||
<path | ||
transform="scale(0.4) rotate(180) translate(10,0)" | ||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" | ||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " | ||
id="path4601" /> | ||
</marker> | ||
<marker | ||
inkscape:stockid="Arrow2Mstart" | ||
orient="auto" | ||
refY="0.0" | ||
refX="0.0" | ||
id="Arrow2Mstart" | ||
style="overflow:visible" | ||
inkscape:isstock="true"> | ||
<path | ||
id="path4183" | ||
style="fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round;stroke:#000000;stroke-opacity:1;fill:#000000;fill-opacity:1" | ||
d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z " | ||
transform="scale(0.6) translate(0,0)" /> | ||
</marker> | ||
<marker | ||
inkscape:stockid="Arrow1Mend" | ||
orient="auto" | ||
refY="0.0" | ||
refX="0.0" | ||
id="Arrow1Mend" | ||
style="overflow:visible;" | ||
inkscape:isstock="true" | ||
inkscape:collect="always"> | ||
<path | ||
id="path4168" | ||
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z " | ||
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1" | ||
transform="scale(0.4) rotate(180) translate(10,0)" /> | ||
</marker> | ||
</defs> | ||
<sodipodi:namedview | ||
id="base" | ||
pagecolor="#ffffff" | ||
bordercolor="#666666" | ||
borderopacity="1.0" | ||
inkscape:pageopacity="0.0" | ||
inkscape:pageshadow="2" | ||
inkscape:zoom="3.3611111" | ||
inkscape:cx="120.9995" | ||
inkscape:cy="105.14521" | ||
inkscape:document-units="px" | ||
inkscape:current-layer="layer1" | ||
showgrid="false" | ||
units="in" | ||
inkscape:window-width="2560" | ||
inkscape:window-height="1379" | ||
inkscape:window-x="1920" | ||
inkscape:window-y="27" | ||
inkscape:window-maximized="1" /> | ||
<metadata | ||
id="metadata4231"> | ||
<rdf:RDF> | ||
<cc:Work | ||
rdf:about=""> | ||
<dc:format>image/svg+xml</dc:format> | ||
<dc:type | ||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
<dc:title></dc:title> | ||
</cc:Work> | ||
</rdf:RDF> | ||
</metadata> | ||
<g | ||
inkscape:label="Layer 1" | ||
inkscape:groupmode="layer" | ||
id="layer1" | ||
transform="translate(0,-872.36215)"> | ||
<rect | ||
style="opacity:1;fill:#878787;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||
id="rect4151" | ||
width="252.7438" | ||
height="10.413223" | ||
x="-489.34341" | ||
y="916.44434" | ||
rx="0" | ||
ry="0" | ||
transform="matrix(0.86525768,-0.50132739,0.50132739,0.86525768,0,0)" /> | ||
<rect | ||
style="opacity:1;fill:#878787;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" | ||
id="rect4149" | ||
width="36.743797" | ||
height="20.975229" | ||
x="334.47769" | ||
y="-935.25085" | ||
ry="1.9338843" | ||
rx="3.8677685" | ||
transform="matrix(-0.87030691,0.49250978,-0.49250978,-0.87030691,0,0)" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend)" | ||
d="M 38.380165,1042.6927 131.20661,989.13901" | ||
id="path4153" | ||
inkscape:connector-curvature="0" | ||
sodipodi:nodetypes="cc" /> | ||
<text | ||
xml:space="preserve" | ||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
x="100.26447" | ||
y="1023.6514" | ||
id="text4501" | ||
sodipodi:linespacing="125%"><tspan | ||
sodipodi:role="line" | ||
id="tspan4503" | ||
x="100.26447" | ||
y="1023.6514" | ||
style="font-size:17.5px">x<tspan | ||
style="font-size:64.99999762%;baseline-shift:sub" | ||
id="tspan4507">c</tspan></tspan></text> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="m 87.192722,890.41573 5.789029,6.4627 c 0,0 11.268949,1.73825 11.459939,6.05433 0.15694,3.5463 -8.939835,5.78682 -8.939835,5.78682 0,0 17.602265,1.25928 18.153375,7.82562 0.29688,3.53732 -8.93984,5.78682 -8.93984,5.78682 0,0 17.60226,1.25927 18.15336,7.82561 0.2969,3.53734 -8.93983,5.78682 -8.93983,5.78682 0,0 17.60225,1.25928 18.15337,7.82562 0.29689,3.53733 -8.93984,5.78682 -8.93984,5.78682 0,0 11.36441,-2.94841 13.5466,1.0194 1.10746,2.01365 -3.24487,6.08294 -3.24487,6.08294 l 8.94372,13.2138" | ||
id="path4509" | ||
inkscape:connector-curvature="0" | ||
sodipodi:nodetypes="ccscscscscscc" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="M 77.652893,895.71752 100.41322,881.88281" | ||
id="path4511" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="m 78.099174,894.97372 1.190082,-10.26446" | ||
id="path4513" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="m 84.396695,891.64314 1.190082,-10.26445" | ||
id="path4513-6" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="M 91.586777,887.19685 92.776859,876.9324" | ||
id="path4513-2" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="m 99.586777,883.19685 1.190083,-10.26444" | ||
id="path4513-2-9" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="m 129.12397,996.87455 c 7.50466,13.72735 7.9919,31.61045 -0.29752,45.83475" | ||
id="path4551" | ||
inkscape:connector-curvature="0" | ||
sodipodi:nodetypes="cc" /> | ||
<text | ||
xml:space="preserve" | ||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
x="141.0248" | ||
y="1029.7505" | ||
id="text4553" | ||
sodipodi:linespacing="125%"><tspan | ||
sodipodi:role="line" | ||
id="tspan4555" | ||
x="141.0248" | ||
y="1029.7505" | ||
style="font-size:17.5px">𝝷</tspan></text> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
d="m 38.082645,1042.6927 190.710745,0" | ||
id="path4557" | ||
inkscape:connector-curvature="0" /> | ||
<path | ||
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-start:url(#Arrow2Mstart);marker-end:url(#Arrow2Mend)" | ||
d="m 99.966942,883.51918 51.619838,80.62809" | ||
id="path4559" | ||
inkscape:connector-curvature="0" /> | ||
<text | ||
xml:space="preserve" | ||
style="font-style:normal;font-weight:normal;font-size:17.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" | ||
x="136.41322" | ||
y="916.69275" | ||
id="text4881" | ||
sodipodi:linespacing="125%"><tspan | ||
sodipodi:role="line" | ||
id="tspan4883" | ||
x="136.41322" | ||
y="916.69275">L<tspan | ||
style="font-size:65%;baseline-shift:sub" | ||
id="tspan4885">0</tspan>=0.5m</tspan></text> | ||
</g> | ||
</svg> |