Unformatted text preview:

6.01, Spring Semester, 2008—Assignment 5, Issued: Tuesday, Mar. 4 1MASSACHVSETTS INSTITVTE OF TECHNOLOGYDepartment of Electrical Engineering and Computer Science6.01—Introduction to EECS ISpring Semester, 2008Assignment 5, Issued: Tuesday, Mar. 4Overview 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 2Software 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 = system F u n c t i o nFromDiffere n c e E q u ation ([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:syste m F u n c t i onFromDiffer e n c e E q uation ([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 3> sf = system F u n c t i o nFromDiffere n c e E q u ation ([9 , -4 , 5] , [0 , 2])> sf . poles ()Ma gnitude of poles : [0 .745 3559 9249 9929 9 , 0 . 7 453559 9 2 499929 9 ][(0.22 2 2 2 2 2 2 2 2 2222227+0.7114 5 8 2 4 8 6 0 3 6 4981 j ) ,(0. 2 2 2222222 2 2 222218 - 0.71145 8 2 486036 4 9 81 j )]> sf2 = syste m F u n c t i onFromDiffer e n c e E q u ation ([3 , -4 , 5] , [0 , 2])> sf . poles ()Ma gnitude of poles : [1 .290 9944 4873 5805 6 , 1 . 2 909944 4 8 735805 6 ]Dang er . Warning . Unstab le syste m .[(0.66 6 6 6 6 6 6 6 6 6666663+1.105 5 4 1 5 9 6 7 8 5 1332 j ) ,(0. 6 6 666666 6 6 6666663 - 1.1055 4 1 596785 1 3 32 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 = syste m F u n c t i onFromDiffer e n c e E q u ation ([3 , -4 , 5] , [0 , 2])> sf2 . p l otSe quenc e ([1] , [0 , 1] , lambda 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 …


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?