Unformatted text preview:

6.01, Spring Semester, 2008—Assignment 5, Issued: Tuesday, Mar. 4: Includes revised design lab1MASSACHVSETTS INSTITVTE OF TECHNOLOGYDepartment of Electrical Engineering and Computer Science6.01—Introduction to EECS ISpring Semester, 2008Assignment 5, Issued: Tuesday, Mar. 4: Includes revised design labOverview of this week’s workIn software lab• Work through the software lab.• Paste your solution to Question 7 into the tutor.Before the start of your design lab on Mar 4 or 5• Read the class notes and review the lecture handout.• Do the on-line tutor problems in section PS.6.2.• Read the entire description of the design lab, so that you will be ready to work on it whenyou get to lab.In design lab• Take the nanoquiz in the first 15 minutes; don’t be late.• Work through the design lab with a partner, and take good notes on the results of your work.At the beginning of your next software lab on Mar 11 or 12• Submit online tutor problems in section PS.6.3.• Submit written solutions to questions 7–9, 11, 14–19, and 20. All written work must conformto the homework guidelines on the web page.Get the lab5 files via athrun 6.01 update or from the home page.6.01, Spring Semester, 2008—Assignment 5, Issued: Tuesday, Mar. 4: Includes revised design lab2Software Lab: System Functions for Robot ControllerWe saw in lecture this week that the behavior of a linear time-independent system can be completelycharacterized using a ratio of two polynomials in R, the delay operator. We call this characterizationthe system function. Further, we saw that systems composed of multiple LTI components can bedescribed using system functions that are relatively simple compositions of the system functions ofthe components. It is possible to solve such problems by hand, with a paper and pencil, but whydo that when we can get a computer to do the work for us?!In this software lab and the next we will build and use a set of tools for analyzing, simulating, andcombining system functions. The file SystemFunctionSkeleton.py contains the definition of theclass SystemFunction, with some methods filled in, and others just documented, but with passinstead of the method body. We’ll fill in its methods this week and next. We’ll also give youSystemFunction.pyc, which is a complete compiled version of that module.Making System FunctionsThe module SystemFunction contains a function that constructs a new instance of the SystemFunctionclass, given a characterization of that system function as a difference equation. Assume that thedifference equation has the forma0y[n] + a1y[n − 1] + ... + aky[n − k] = b0x[n] + b1x[n − 1] + ... + bjx[n − j] ,where X is the input signal and Y is the output signal. It is crucial that the first coefficient of bothpolynomials be from the same time step; but they can go back different depths in history.To make a new system function, say corresponding to the difference equation9y[n] − 4y[n − 1] + 5y[n − 3] = 2x[n − 1] ,we’d make the call> sf = sys tem Fun cti onF rom Di f fe r en c eE qua tio n ([9 , -4, 5] , [0 , 2])You can see from printing out the system function, that we store it as a ratio of polynomials in R:> sfSF (2.000 R /5.000 R **2 + -4.000 R + 9 .000)Question 1: Describe in English what this system does:sy ste mFu nct ion Fro mD i ff e re n ce Equ ati on ([1] , [0 , 0 , 1])Question 2: What call would you make to generate the system function for a system with thisdifference equation:y[n] = 2y[n − 2] + 3x[n − 3] ?Understanding a systemA crucial thing to understand about a system is whether, even in the absence of input, its outputwill go to zero, or whether it will grow unboundedly. We can find this out by determining the polesof the system. So, for example, if you ask for the poles of a system function, you’ll get a report onthe poles of the system and their implications for the stability of the system:6.01, Spring Semester, 2008—Assignment 5, Issued: Tuesday, Mar. 4: Includes revised design lab3> sf = sys tem Fun cti onF rom Di f fe r en c eE qua tio n ([9 , -4, 5] , [0 , 2])> sf . poles ()Magni tude of poles : [0.7453 55 99 2499929 9 , 0. 745 35 599 24 99929 9][( 0.2 222 222 222 222 222 7+0 .71 145 824 860 364 981 j ) ,(0 .2 222 22 222 22 222 21 8 - 0.7 11 458 24 860 36 4981 j )]> sf2 = s y st e mF unc tio nFr omD iff ere nc e Eq u at i on ([3 , -4, 5] , [0 , 2])> sf . poles ()Magni tude of poles : [1.2909 94 44 8735805 6 , 1. 290 99 444 87 35805 6]Danger . Warnin g . Unstab le syst em .[( 0.6 666 666 666 666 666 3+1 .10 554 159 678 513 32 j) ,(0 .6 666 66 666 66 66666 3 - 1.1 05 54159 67 851 33 2 j )]Another way to get an understanding of how a system is working is to start it at some initialconditions, and simulate it by running the associated difference equation forward. We have builtfacilities for doing this into the SystemFunction class.Let k be the order of the polynomial on the Y terms (also called the order of the system) and jbe the order of the polynomial on the X terms. We need j initial input values and k initial outputvalues in order to be able to specify all future values of the system. In addition, we need to providean input sequence; for generality, instead of providing a list, we use a function from n to x[n].So, given initial values (the lists [x[0], . . . , x[j − 1]] and [y[0], . . . , y[k − 1]]) and an input source, theSystemFunction.plotSequence method plots the sequence of Y values.So, for example, you can do> sf2 = s y st e mF unc tio nFr omD iff ere nc e Eq u at i on ([3 , -4, 5] , [0 , 2])> sf2 . plotSequence ([1] , [0 , 1] , lambd a x: 1, n = 30 , idle = True )and get the plot shown in figure 1. The last two arguments are optional. n controls the number ofpoints that are plotted; idle controls whether the plotting will work nicely with Idle. If you callthis with idle set to True, then you will have to close the plotting window before your program thatcalled this method (or the Python shell) can continue to run.Question 3: Experiment with plots of sf2 above with different initial conditions and inputs.Robot meets wallNow, let’s return to the problem of the robot driving up to the wall. We would like to determinewhether this system is stable. Doing so will require several steps, laid out in the questions below.Question 4: Imagine a robot driving straight toward a wall. We would like to use a differenceequation to model this system, where the output, D, is the distance from the robot to thewall in


View Full Document

MIT 6 01 - Assignment - 6.01

Documents in this Course
Week 1

Week 1

3 pages

Op-Amps

Op-Amps

8 pages

Op-Amps

Op-Amps

6 pages

Syllabus

Syllabus

14 pages

Planning

Planning

14 pages

Load more
Download Assignment - 6.01
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Assignment - 6.01 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Assignment - 6.01 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?