Skip to content

Instantly share code, notes, and snippets.

@moriarty
Created April 27, 2013 12:44
Show Gist options
  • Save moriarty/5472996 to your computer and use it in GitHub Desktop.
Save moriarty/5472996 to your computer and use it in GitHub Desktop.
BRSU MRC A#3
{
"metadata": {
"name": "brsu_mrc_assignment_003"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<style type=\"text/css\">\n",
".time_spent {\n",
" width: 3em;\n",
" border-style: none;\n",
" background-color: silver;\n",
" font-weight: bold;\n",
" padding-left: 5px;\n",
"}\n",
"</style>"
]
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Mathematics for Robotics and Control - Assignment 3: Pole-Zero Plots / System Properties"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import sys\n",
"THIS_IS_NEITHER_WINDOWS_NOR_LINUX = (\"win\" not in sys.platform and \"linux\" not in sys.platform)\n",
"\n",
"# Windows and Linux so far have no problem with the inline backend...\n",
"# ...on other platforms we did run into problems in the past, so let's use the default backend\n",
"if THIS_IS_NEITHER_WINDOWS_NOR_LINUX:\n",
" %pylab\n",
"else:\n",
" %pylab inline"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"\n",
"Welcome to pylab, a matplotlib-based Python environment [backend: module://IPython.kernel.zmq.pylab.backend_inline].\n",
"For more information, type 'help(pylab)'.\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "heading",
"level": 4,
"metadata": {},
"source": [
"Assignment 3.1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Answer the following questions:*\n",
"\n",
"1. How is a PZ plot related to the system's transfer function?\n",
"2. Does a PZ plot completely characterize a system?\n",
"3. Is is possible to recover the differential equation from nothing but a PZ-Plot? If not, why not? \n",
"4. Can you judge a system's stability by it's PZ plot? If so, how? Does the order of a system have any impact on it's stability? Are there different kinds of stability?\n",
"5. Given a PZ plot, can you judge how long it will take the system to reach equilibrium?\n",
"6. How does the Hurwitz polynomial relate to the analysis of dynamic systems?\n",
"7. Assuming a PZ plot shows complex poles and/or zeros. What does immediately follow w.r.t. the complex poles/zeros? Why?\n",
"8. What is the homogeneous response?\n",
"9. What is the time constant $\\tau$?\n",
"10. What is the canonical form of the homogeneous response of a first-order system?"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Assignment 3.1 took me* <input class=\"time_spent\" name=\"ex31_time_spent\" /> *minutes.*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "heading",
"level": 4,
"metadata": {},
"source": [
"Assignment 3.2"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Plot the PZ plot of the following systems and discuss their properties (i.e. stability, transient response etc.). Give as much info about each system as you can and *specify proof/reasons for each of your claims!*\n",
"\n",
"1. $G(s) = \\frac{1}{s^2 + \\sqrt(2) \\cdot s + 1}$\n",
"2. $G(s) = \\frac{4}{s^2 + s - 2}$\n",
"3. $G(s) = \\frac{30}{s^2 + \\frac{3}{10} \\cdot s + 10}$\n",
"4. $A = \\begin{bmatrix}3 & -3 & 2\\\\1 & 1 & 1\\\\-4 & 2 & 1\\end{bmatrix}, B = \\begin{bmatrix}0\\\\1\\\\1\\end{bmatrix}, C = \\begin{bmatrix}0 & 1 & 0\\end{bmatrix}, D = 2$"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"*Assignment 3.2 took me* <input class=\"time_spent\" name=\"ex32_time_spent\" /> *minutes.*"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"<script type=\"text/javascript\">\n",
" function validTime(minutes) { \n",
" var numberIsSane = isFinite(parseInt(minutes, 10)) && (parseFloat(minutes, 10) == parseInt(minutes, 10)); \n",
" var numberInRange = ( (minutes >= 1) && (minutes < 60*24*7) );\n",
" return (numberIsSane && numberInRange);\n",
" }\n",
" function create_time_file(filename) {\n",
" var kernel = IPython.notebook.kernel;\n",
" if (kernel) {\n",
" var studentName = $('#usrname').val();\n",
" var inputElements = $(':text.time_spent');\n",
" var timings = new Array();\n",
" if (inputElements) {\n",
" var allTimesAreValid = true;\n",
" var invalidTimeValue = null;\n",
" inputElements.each(function() {\n",
" if (!validTime(this.value)) {\n",
" allTimesAreValid = false;\n",
" invalidTimeValue = this.value;\n",
" return;\n",
" }\n",
" timings.push(this.value);\n",
" });\n",
" if (!allTimesAreValid) {\n",
" alert('Unable to save assignment times, invalid time value <' + invalidTimeValue + '>');\n",
" return;\n",
" }\n",
" if (!studentName) {\n",
" alert('Please include your name in the submission');\n",
" return;\n",
" }\n",
" if (confirm('Here are the timings I am going to save:\\n\\n' + timings.join(\" minutes\\n\") + ' minutes\\n\\nDo you want me to continue?')) {\n",
" var pyCode = [\n",
" 'with open(\"' + filename + '\", \"w\") as timings_file:',\n",
" 'print >>timings_file, \"NAME:\", \"' + studentName + '\"',\n",
" 'print >>timings_file, \"ASSIGNMENT TIMES:\"'\n",
" ];\n",
" timings.forEach(function(minutesTaken, assignmentIndex, arr) {\n",
" pyCode.push('print >>timings_file, \"{0:03d}: {1:05d}\".format(' + assignmentIndex + ', ' + minutesTaken + ')');\n",
" });\n",
" kernel.execute(pyCode.join('\\n '));\n",
" }\n",
" }\n",
" }\n",
" else {\n",
" alert('Unable to save, please manually create a file containing the times spent working on the assignments');\n",
" }\n",
" }\n",
"</script>\n",
"\n",
"*Use this button to create a .txt file containing the time in minutes you spent working on the assignments. Make sure to include your name in the textbox below. The file will be created in the current directory.*\n",
"\n",
"\n",
"Student's name:\n",
"\n",
"<input type=\"text\" id=\"usrname\" name=\"student_name\" />\n",
"\n",
"<input type=\"button\" onclick=\"javascript:create_time_file('assignment_times_mrc_0003.txt')\" value=\"Save timings\" />"
]
}
],
"metadata": {}
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment