Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
{
"cells": [
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"%plot --format svg"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"setdefaults"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![double pendulum](./figures/p1-10_double_pendulum.png)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"image/svg+xml": [
"<svg height=\"420px\" viewBox=\"0 0 560 420\" width=\"560px\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
"\n",
"<title>Gnuplot</title>\n",
"<desc>Produced by GNUPLOT 5.0 patchlevel 3 </desc>\n",
"\n",
"<g id=\"gnuplot_canvas\">\n",
"\n",
"<rect fill=\"none\" height=\"420\" width=\"560\" x=\"0\" y=\"0\"/>\n",
"<defs>\n",
"\n",
"\t<circle id=\"gpDot\" r=\"0.5\" stroke-width=\"0.5\"/>\n",
"\t<path d=\"M-1,0 h2 M0,-1 v2\" id=\"gpPt0\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,-1 L1,1 M1,-1 L-1,1\" id=\"gpPt1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<path d=\"M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1\" id=\"gpPt2\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<rect height=\"2\" id=\"gpPt3\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<rect fill=\"currentColor\" height=\"2\" id=\"gpPt4\" stroke=\"currentColor\" stroke-width=\"0.222\" width=\"2\" x=\"-1\" y=\"-1\"/>\n",
"\t<circle cx=\"0\" cy=\"0\" id=\"gpPt5\" r=\"1\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt6\" stroke=\"none\" xlink:href=\"#gpPt5\"/>\n",
"\t<path d=\"M0,-1.33 L-1.33,0.67 L1.33,0.67 z\" id=\"gpPt7\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt8\" stroke=\"none\" xlink:href=\"#gpPt7\"/>\n",
"\t<use id=\"gpPt9\" stroke=\"currentColor\" transform=\"rotate(180)\" xlink:href=\"#gpPt7\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt10\" stroke=\"none\" xlink:href=\"#gpPt9\"/>\n",
"\t<use id=\"gpPt11\" stroke=\"currentColor\" transform=\"rotate(45)\" xlink:href=\"#gpPt3\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt12\" stroke=\"none\" xlink:href=\"#gpPt11\"/>\n",
"\t<path d=\"M0,1.330 L1.265,0.411 L0.782,-1.067 L-0.782,-1.076 L-1.265,0.411 z\" id=\"gpPt13\" stroke=\"currentColor\" stroke-width=\"0.222\"/>\n",
"\t<use fill=\"currentColor\" id=\"gpPt14\" stroke=\"none\" xlink:href=\"#gpPt13\"/>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"textbox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"white\" flood-opacity=\"1\" result=\"bgnd\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"bgnd\" operator=\"atop\"/>\n",
"\t</filter>\n",
"\t<filter filterUnits=\"objectBoundingBox\" height=\"1\" id=\"greybox\" width=\"1\" x=\"0\" y=\"0\">\n",
"\t <feFlood flood-color=\"lightgrey\" flood-opacity=\"1\" result=\"grey\"/>\n",
"\t <feComposite in=\"SourceGraphic\" in2=\"grey\" operator=\"atop\"/>\n",
"\t</filter>\n",
"</defs>\n",
"<g color=\"white\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<g shape-rendering=\"crispEdges\" stroke=\"none\">\n",
"\t\t<polygon fill=\"rgb(255, 255, 255)\" points=\"80.2,362.4 534.9,362.4 534.9,60.2 80.2,60.2 \"/>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"rgb(255, 255, 255)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M80.2,362.4 L92.7,362.4 M535.0,362.4 L522.5,362.4 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(71.9,368.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">-1000</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M80.2,286.8 L92.7,286.8 M535.0,286.8 L522.5,286.8 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(71.9,292.8)\">\n",
"\t\t<text><tspan font-family=\"{}\">-500</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M80.2,211.2 L92.7,211.2 M535.0,211.2 L522.5,211.2 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(71.9,217.2)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M80.2,135.7 L92.7,135.7 M535.0,135.7 L522.5,135.7 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(71.9,141.7)\">\n",
"\t\t<text><tspan font-family=\"{}\">500</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M80.2,60.1 L92.7,60.1 M535.0,60.1 L522.5,60.1 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(71.9,66.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">1000</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M80.2,362.4 L80.2,349.9 M80.2,60.1 L80.2,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(80.2,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M137.1,362.4 L137.1,349.9 M137.1,60.1 L137.1,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(137.1,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.02</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M193.9,362.4 L193.9,349.9 M193.9,60.1 L193.9,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(193.9,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.04</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M250.8,362.4 L250.8,349.9 M250.8,60.1 L250.8,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(250.8,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.06</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M307.6,362.4 L307.6,349.9 M307.6,60.1 L307.6,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(307.6,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.08</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M364.5,362.4 L364.5,349.9 M364.5,60.1 L364.5,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(364.5,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.1</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M421.3,362.4 L421.3,349.9 M421.3,60.1 L421.3,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(421.3,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.12</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M478.2,362.4 L478.2,349.9 M478.2,60.1 L478.2,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(478.2,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.14</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M535.0,362.4 L535.0,349.9 M535.0,60.1 L535.0,72.6 \" stroke=\"black\"/>\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(535.0,386.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">0.16</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<path d=\"M80.2,60.1 L80.2,362.4 L535.0,362.4 L535.0,60.1 L80.2,60.1 Z \" stroke=\"black\"/></g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(19.1,211.3) rotate(-90)\">\n",
"\t\t<text><tspan font-family=\"{}\">velocity (mm/s)</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(307.6,413.4)\">\n",
"\t\t<text><tspan font-family=\"{}\">time (s)</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"middle\" transform=\"translate(307.6,33.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">Velocity of end point</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"1.00\">\n",
"\t<path d=\"M327.3,165.1 L327.3,69.1 L526.7,69.1 L526.7,165.1 L327.3,165.1 Z \" stroke=\"black\"/></g>\n",
"\t<g id=\"gnuplot_plot_1a\"><title>x-component</title>\n",
"<g color=\"white\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(526.7,99.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">x-component</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M338.5,93.1 L392.3,93.1 M80.2,65.4 L83.8,65.8 L87.4,66.8 L91.0,68.4 L94.6,70.5 L98.2,73.2 L101.8,76.5 L105.5,80.3 L109.1,84.6 L112.7,89.4 L116.3,94.8 L119.9,100.5 L123.5,106.8 L127.1,113.4 L130.7,120.5 L134.3,127.9 L137.9,135.6 L141.5,143.6 L145.1,152.0 L148.8,160.5 L152.4,169.3 L156.0,178.2 L159.6,187.3 L163.2,196.4 L166.8,205.7 L170.4,214.9 L174.0,224.2 L177.6,233.4 L181.2,242.5 L184.8,251.5 L188.4,260.3 L192.1,268.9 L195.7,277.3 L199.3,285.5 L202.9,293.3 L206.5,300.8 L210.1,307.9 L213.7,314.7 L217.3,321.0 L220.9,326.9 L224.5,332.3 L228.1,337.3 L231.7,341.7 L235.3,345.6 L239.0,348.9 L242.6,351.7 L246.2,353.9 L249.8,355.6 L253.4,356.6 L257.0,357.1 L260.6,357.0 L264.2,356.3 L267.8,355.0 L271.4,353.1 L275.0,350.7 L278.6,347.7 L282.3,344.2 L285.9,340.1 L289.5,335.5 L293.1,330.5 L296.7,324.9 L300.3,318.9 L303.9,312.5 L307.5,305.6 L311.1,298.4 L314.7,290.8 L318.3,282.9 L321.9,274.7 L325.5,266.3 L329.2,257.6 L332.8,248.8 L336.4,239.8 L340.0,230.7 L343.6,221.5 L347.2,212.2 L350.8,202.9 L354.4,193.7 L358.0,184.6 L361.6,175.5 L365.2,166.6 L368.8,157.9 L372.5,149.3 L376.1,141.1 L379.7,133.1 L383.3,125.4 L386.9,118.1 L390.5,111.1 L394.1,104.6 L397.7,98.5 L401.3,92.8 L404.9,87.6 L408.5,83.0 L412.1,78.8 L415.8,75.2 L419.4,72.1 L423.0,69.6 L426.6,67.7 L430.2,66.3 L433.8,65.6 L437.4,65.4 \" stroke=\"rgb( 0, 0, 255)\"/></g>\n",
"\t</g>\n",
"\t<g id=\"gnuplot_plot_2a\"><title>y-component</title>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<g fill=\"rgb(0,0,0)\" font-family=\"{}\" font-size=\"16.00\" stroke=\"none\" text-anchor=\"end\" transform=\"translate(526.7,147.1)\">\n",
"\t\t<text><tspan font-family=\"{}\">y-component</tspan></text>\n",
"\t</g>\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"3.00\">\n",
"\t<path d=\"M338.5,141.1 L392.3,141.1 M80.2,208.1 L83.8,208.5 L87.4,208.9 L91.0,209.3 L94.6,209.7 L98.2,210.2 L101.8,210.6 L105.5,210.9 L109.1,211.3 L112.7,211.6 L116.3,211.9 L119.9,212.1 L123.5,212.3 L127.1,212.5 L130.7,212.6 L134.3,212.6 L137.9,212.6 L141.5,212.5 L145.1,212.3 L148.8,212.1 L152.4,211.9 L156.0,211.6 L159.6,211.2 L163.2,210.9 L166.8,210.5 L170.4,210.0 L174.0,209.6 L177.6,209.2 L181.2,208.7 L184.8,208.3 L188.4,207.9 L192.1,207.5 L195.7,207.1 L199.3,206.8 L202.9,206.5 L206.5,206.2 L210.1,206.0 L213.7,205.9 L217.3,205.8 L220.9,205.8 L224.5,205.8 L228.1,205.8 L231.7,205.9 L235.3,206.1 L239.0,206.3 L242.6,206.5 L246.2,206.8 L249.8,207.1 L253.4,207.5 L257.0,207.9 L260.6,208.3 L264.2,208.7 L267.8,209.1 L271.4,209.5 L275.0,209.9 L278.6,210.4 L282.3,210.7 L285.9,211.1 L289.5,211.5 L293.1,211.8 L296.7,212.0 L300.3,212.2 L303.9,212.4 L307.5,212.5 L311.1,212.6 L314.7,212.6 L318.3,212.5 L321.9,212.4 L325.5,212.2 L329.2,212.0 L332.8,211.7 L336.4,211.4 L340.0,211.1 L343.6,210.7 L347.2,210.3 L350.8,209.8 L354.4,209.4 L358.0,208.9 L361.6,208.5 L365.2,208.1 L368.8,207.7 L372.5,207.3 L376.1,206.9 L379.7,206.6 L383.3,206.4 L386.9,206.1 L390.5,206.0 L394.1,205.8 L397.7,205.8 L401.3,205.7 L404.9,205.8 L408.5,205.9 L412.1,206.0 L415.8,206.2 L419.4,206.4 L423.0,206.7 L426.6,207.0 L430.2,207.3 L433.8,207.7 L437.4,208.1 \" stroke=\"rgb( 0, 128, 0)\"/></g>\n",
"\t</g>\n",
"<g color=\"white\" fill=\"none\" stroke=\"rgb( 0, 128, 0)\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"2.00\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"black\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"<g color=\"black\" fill=\"none\" stroke=\"currentColor\" stroke-linecap=\"butt\" stroke-linejoin=\"miter\" stroke-width=\"0.50\">\n",
"</g>\n",
"</g>\n",
"</svg>"
],
"text/plain": [
"<IPython.core.display.SVG object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"clear all; close all\n",
"t=linspace(0,2*pi/50,100); % create time varying from 0-0.126 s (or one period)\n",
"x=20*sin(50*t);dx=20*50*cos(50*t); % define x and dx/dt in terms of time (note dx=dx/dt)\n",
"t1=0.2*pi*cos(50*t); dt1=-10*pi*sin(50*t); % define theta1 (t1) and dtheta1/dt\n",
"t2=0.2*pi*sin(50*t-pi/3); dt2=10*pi*sin(50*t-pi/3); % define theta2 (t2) and dtheta2/dt;\n",
"L1=1;L2=1.5; % set lengths for L1 and L2 (none were given in problem so 1 and 1.5 mm were\n",
" % chosen arbitrarily\n",
"rcc=[x+L1*sin(t1);-L1*cos(t1)]; % position of connection between links\n",
"rco=[x+L1*sin(t1)+L2*sin(t2);-(L1*cos(t1)+L2*cos(t2))]; % create a row vectors of\n",
" % x-component and y-component of\n",
" % pendulum position C (r_C/O) \n",
"vco=[dx+L1*cos(t1).*dt1+L2*cos(t2).*dt2;(L1*sin(t1).*dt1+L2*sin(t2).*dt2)]; % create row\n",
" % vectors of\n",
" % the x- and\n",
" % y-component\n",
" % velocity of\n",
" % point C\n",
"\n",
"\n",
"figure(1)\n",
"plot(t,vco(1,:),t,vco(2,:))\n",
"xlabel('time (s)')\n",
"ylabel('velocity (mm/s)')\n",
"legend('x-component','y-component')\n",
"title('Velocity of end point')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Link positions over time (animation)\n",
"\n",
"![links](./pendulum.gif)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Octave",
"language": "octave",
"name": "octave"
},
"language_info": {
"file_extension": ".m",
"help_links": [
{
"text": "MetaKernel Magics",
"url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
}
],
"mimetype": "text/x-octave",
"name": "octave",
"version": "0.19.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}