text
stringlengths
30
4k
source
stringlengths
60
201
, if we try to refer to one of these names when interacting with the evaluator, we will get an unbound variable error. But these names can be referenced by expressions that exist within the scope of this lambda. The rules of evaluation say that when we apply sqrt to some argument, the body of this lambda will be e...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
for strings, things like string=?, substring; for Booleans, things like and, or, not. To put these primitive elements together into more interesting expressions, we have a means of combination, that is, a way of combining simpler pieces into expressions that can themselves be treated as elements of other expressio...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
, we are going to generalize the idea of abstractions to include those that focus on data, rather than procedures. So we are going talk about how to create compound data objects, and we are going to examine standard 6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute ...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
the "glue" and the "unglue" work hand in hand, guaranteeing that however, the compound unit is created, we can always get back the parts we started with. 6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 5.2.5 And ideally we would like the p...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 5.2.8 In this way, we can create elements that are naturally thought of as simple units that happen to themselves be created out of elements that are also thought of as simple units. This allows ...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
to that object. The key issue here is the contract between the constructor and the selectors. The details of how a constructor puts things together are not at issue, so long as however the pieces are glued together, they can be separated back out into the original parts by the selectors. Slide 5.2.10 So here we ju...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
data object with scaled versions of those values as the parts. Slide 5.3.3 And we can generalize this idea to handle operations on segments, as well as points. Note how each of these procedures builds on constructors and selectors for the appropriate data structure, so that in examining the code, we have no sense ...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
arbitrary number of ordered elements within it. Slide 5.3.6 Of course, we could make a list by just consing together a set of things, using however many pairs we need. But it is much more convenient to think of a list as a basic structure, and here is more formally how we define such a structure. A list is a sequ...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
represented by a pair of boxes. The first box contains a pointer to the value of the first argument to cons and the second box contains a pointer to the value of the second argument to cons. The pair also has a pointer into it, and that pointer is the value returned by evaluating the cons expression, and represents...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
of a list, and for putting a new element onto the front of a list. Notice how these operations inherit the necessary closure properties from their implementation in terms of cons, car and cdr. Slide 5.3.12 A key point behind defining a new data abstraction is that it should make certain kinds of operations easy t...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
empty list. Slide 5.3.14 Now we are ready to evaluate the innermost expression, which actually creates a cons pair. To demonstrate this, we have drawn in the pair to show that this is the value returned by adjoin. Notice how it has the correct form for a list. Slide 5.3.15 The next evaluation adjoins another ele...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
3. Slide 5.3.18 A related procedure is to count up the number of elements in a list, using the same sort of recursive reasoning. Length of a list is defined as 1 more than the length of the rest of a list, which by the closure property is also a list. The base case is the empty list, which has zero length. Slide...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
, and in particular notice how the recursive structure of the procedure nicely mimics the recursive structure of the data object. Slide 5.3.21 So now we can put these ideas to work in handling more complex structures. Let’s group together a set of points using a list. Then we can easily write a procedure to stretc...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
for just as we would in the standard substitution model. 6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. Slide 5.3.23 So to summarize: we have seen that languages often provide conventional ways of grouping data elements into structures, here eit...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
we rely on the user showing discipline when applying procedures to data structures, expecting them not to use procedures that directly take advantage of the implementation of the structure. Sometimes we are much better off imposing strong abstraction barriers between structures, thereby not allowing a user to take...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
extended example, and remember that the point we are trying to drive home is the separation of the details of implementation of an abstraction from the use of that abstraction. We are going to place this solid barrier between the implementation and use of an abstraction, and we are going to see why having that bar...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
as rational addition or rational multiplication, and notice the types of these operations. They take two rationals as input, and produce a rational as output. Of course, we are going to separate all of this from the actual implementation of rationals. We should ideally be able to take any implementation of rationals...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
We'll see some advantages shortly, but the key point here is that from the user's perspective each implementation is equally valid, as each satisfies the contract. Slide 5.4.9 For example, here is a useful procedure for rationals, which will print out the value of a rational by separating the numerator and denomi...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
rational number; hence my contract for these procedures is met, given that the contracts for the constructors and selectors are met. Slide 5.4.12 Okay, let's use this little system. We can create a couple of simple rationals as shown, making one-half and three- fourths to be the expected rationals. Let's define ne...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
The point, however, is to do this in a way that is invisible to the user. Slide 5.4.15 To do that, we will just use an implementation of gcd, which computes the greatest common divisor of two integers, as shown here. Let's use this to make "better" rationals. Slide 5.4.16 ... and here we have a choice. The first...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
have a system that creates relatively few rationals but accesses them a lot, then for efficiency we should do the reduction at construction time. But if we expect the opposite load, we can use the other implementation. Slide 5.4.18 To finish making this point, think about what would happen if we didn't use the da...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/1239c38467fc8018b19c808d121bcf5d_lecture5webhand.pdf
6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachusetts Institute of Technology. 6.001 Notes: Section 4.1 Slide 4.1.1 In this lecture, we are going to take a careful look at the kinds of procedures we can build. We will first go back to look very carefully at the substitution mod...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
its alternative. Slide 4.1.6 And finally: combinations. We use the rule that we first evaluate the operator expression to get the procedure, and we evaluate the operands to get the set of arguments. If we have a primitive procedure, we are just going to “do the right thing”. Otherwise we are going to replace this...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
4.1.9 So let's use our rewrite rule idea, together with this notion of measuring the amount of resource we need as an order of growth in the size of the problem. Here is our recursive factorial procedure ... Slide 4.1.10 ..and here is a partial trace of fact using those rewrite rules. We start with (fact 4). Tha...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
the size of the problem. We say that it is constant, as it does not grow with n. In terms of time, there is basically one operation for each increment in the argument, so this is again a linear order of growth. Slide 4.1.12 So we can formally capture this, as shown. Fact has linear growth in space, written as sh...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
is 0, if its argument is 1, its value is 1, and for all other positive integer arguments, its value is the sum of its values for the two preceding arguments. We would like to write a procedure to compute Fibonacci, and in particular see how it gives rise to a different kind of behavior. Slide 4.2.2 To solve this...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
we expressed. We keep recursively solving smaller sized problems until we get to a base case. Notice that here we have two base cases, not one. Also notice that while this is a recursive procedure, it is different from our earlier ones. Here, there are two recursive calls to the procedure in the body, rather than j...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
that we have basically one deferred operation for step, or in other words, the maximum depth of that tree is linear in the size of the problem, and the maximum depth exactly captures the maximum number of deferred operations. 6.001 Notes: Section 4.3 6.001 Structure and Interpretation of Computer Programs. Copyrigh...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
. Thus, we can reduce a to the bth power as a times a to the b-1st power. Thus we can reduce the problem to a simpler version of the same problem, together with some simple operations, in this case, an additional multiplication. 6.001 Structure and Interpretation of Computer Programs. Copyright © 2004 by Massachus...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
saw earlier, we expect there are other ways of creating procedures to solve the same problem. With factorial, we used the idea of a table of state variables, with update rules for changing the values of those variables. We should be able to do the same thing here. Slide 4.3.10 So recall the idea of our table. We ...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
, so we are done. And when we get there, the answer is in the product column. Slide 4.3.16 And finally, we see that the starting point is just that anything to the zeroth power is 1. Slide 4.3.17 So now we can capture this in a procedure. As with factorial, we are going to use a helper procedure. And as in that...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
key is to find a way to reduce this problem to a combination of simpler problems, either simpler versions of the same problem or more basic operations. For this problem, here is the trick I can play. If b is an even integer, then I can recognize that raising a to the power of b is the same as first square a, then ...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
application of the procedure for even cases, and a different one for odd cases. Of course, there is a base case to terminate the reduction of the problem to simpler versions. The form of this procedure is a bit different. In one case, it looks like an iterative call (with just a change in the parameters of the pro...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
same kind of reasoning will show you that the space requirements also grow logarithmically with the size of the problem. Slide 4.4.8 To summarize, we have now seen how our substitution model helps to explain the evolution of a process that occurs when a procedure is applied. Using this model, we have seen that ver...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
row. Our goal is to determine how to compute all elements of each row. Slide 4.5.3 Traditionally, Pascal’s triangle is constructed by noting that the first and last element of each row (except the first) is a 1, and by noting that to get any other element in a row, we add the corresponding element of the previous...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
actuality, Pascal’s triangle is capturing the number of different ways of choosing a set of j objects from a set of n objects (this isn’t obvious, by the way, so just accept this as a fact). Thus, the first element of a row is the number of ways of picking no objects, which is by definition 1. The last element of ...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
any better with this version of Pascal? Sure! We know that this version of fact is linear. Our Pascal implementation uses fact three different evaluations of fact, but this is still linear in time, and a similar analysis lets us conclude that this is linear in space as well. While it might take three times as long...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
.5.15 And that leads to our concluding point. First, we stress that the same problem may have many different solutions, and that these solutions may have very different computational behaviors. Some problems are inherently exponential in nature. Others may have straightforward solutions that have exponential beha...
https://ocw.mit.edu/courses/6-001-structure-and-interpretation-of-computer-programs-spring-2005/124c1c683236effa0fe4f7d4318ac9b7_lecture4webhand.pdf
Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 169 Chapter 5 Signals and Systems Imagine that you are asked to design a system to steer a car straight down the middle of a lane. It seems easy, right? You can figure out some way to sense the position of the car within its lane. Then, if the car is r...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
2011 170 Figure 5.2 Signals and Systems: the system transforms an input signal into an output signal. This diagram represents a system with one input and one output. Both the input and output are signals. A signal is a mathematical function with an independent variable (most often it will be time for the problems ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
signal alone tells us a great deal about how well we are steering. Consider a plot of po (t) that corresponds to figure 5.1, as follows. The oscillations in po lane. Thus, this signal clearly represents an important failure mode of our car steering system. (t) as a function of time correspond to the oscillations of ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
s. The input to the car is the angle of the steering wheel. Let’s call that angle φ(t). The output of the car is its position in the lane, po(t), measured as the lateral distance to the center of the lane. The steering controller turns the steering wheel to compensate for differences between our desired position in...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
unimportant outputs. Think about the number of moving parts in a car. They are not all important for steering! carφ(t)po(t)steeringcontrollere(t)φ(t) Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 172 Figure 5.3 Modularity of systems complex, system. A principal goal of this chapter is to develop...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
pixels accessed by integer-valued rows and columns, rather than as continuous brightness fields, indexed by real-valued spatial coordi­ nates. If the car-steering problem in figure 5.1 were modeled in discrete time, we could describe the system with a diagram that is very similar to the continuous-time diagram in figure 5...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
state machines, called discrete-time linear time-invariant (LTI) systems, which will allow deeper forms of analysis. In an LTI system: • • The state is some fixed number of previous inputs to the system as well as a fixed number of Inputs and outputs are real numbers; previous outputs of the system; and • The outp...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
1— April 25, 2011 174 We will say that systems transduce input signals into output signals. 5.2.1 Unit sample signal We will work with a single primitive, called the unit sample signal, ∆. It is defined on all positive and negative integer indices as follows35: (cid:10) δ[n] = 1 if n = 0 0 otherwise . That is...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
Systems 6.01— Spring 2011— April 25, 2011 175 Finally, we can add two signals together. Addition of signals is accomplished component-wise, so that if Y = X1 + X2 then y[n] = x1[n] + x2[n] . That is, the value of the composite signal at step n is the sum of the values of the component sig­ nals. Here are some ne...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
Advancing If we allow ourselves one more operation, that of ’advancing’ the signal one step (just like delaying, but in the other direction, written L for left-shift), then any signal can be composed from the unit sample, using a (possibly infinite) number of these operations. We can demonstrate this claim by constr...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
addition, R distributes over addition and scaling, so that: R(X1 + X2) = RX1 + RX2 R(c X) = c RX . · · Exercise 5.3. Verify that R distributes over addition and multiplication by checking that the appropriate relations hold at some arbitrary step n. These algebraic relationships mean that we can take any finite e...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
as follows: s1[n] = cos(0.2n − π/2) S2 = R10S1 S3 = S1 + S2 The blue line is the S1, the green line is the same signal, delayed by 10, which is S2, and the red line is their sum. 1.099-1.0901000 Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 178 5.3 Feedforward systems We will start by looking a...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
of the relationship between signals is a difference equation. A dif­ ference equation describes a relationship that holds among samples (values at particular times) of signals. We use an index n in the difference equation to refer to a particular time index, but the specification of the corresponding system is that th...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
lines represent signals; all lines that are connected to one another (not going through a round, triangular, or circular component) represent the same signal. The components represent systems. There are three primitive components corresponding to our operations on signals: • Delay components are drawn as rectangle...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
of the previous input. One important thing to notice is that, since we have to be able to run a state machine and generate outputs, it has to start with a value for its internal state, which is the input signal’s value at time −1. If we were to run: Diff(0).transduce([1, 0, 0, 0]) we would get the result [1, -1, 0...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
ative, cascade combination is commutative as well (as long as the systems are at rest, which means that their initial states are 0). · So, for example, R(1 − R) X = (1 − R)RX and these two corresponding block diagrams are equivalent (the algebraic equivalence justifies the diagram equivalence): Cascade combinatio...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
law applies for cascade and parallel combination, for systems at rest, in the same way that it applies for multiplication and addition of polynomials, so that if we have three systems, with operator equations: Y = Φ1X U = Φ2V W = Φ3Z , and we form a cascade combination of the sum of the first two, with the third, ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
Delay−12−1++XYDelayDelayDelayDelay−12−1++XY Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 184 Exercise 5.7. Convince yourself that all of these systems are equivalent. One strategy is to convert them all to operator equation representation. 5.4 Feedback Systems So far, all of our example systems...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
values of the inputs and outputs at steps less than 0 are 0. That assumption lets us fill in the following table: y[n] = x[n] + y[n − 1] y[0] = x[0] + y[−1] = 1 + 0 = 1 y[1] = x[1] + y[0] = 0 + 1 = 1 y[2] = x[2] + y[1] = 0 + 1 = 1 · · · Here are plots of the input signal X and the output signal Y: This result may be...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
= (1 + R + R2 + R3 + ) X · · · and can be represented with a block diagram of the form: −101234nx[n]=δ[n]−101234ny[n] Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 186 These systems are equivalent in the sense that if each is initially at rest, they will produce identical outputs from the same in...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
x + x 2 + x 3 + · · · Similarly, we can consider the system O, where DelayDelayDelayDelayDelayDelay+......XY Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 187 O = 1 + R + R2 + R3 + · · · R + R2 + R3 + · · · OR = So O(1 − R) = 1 And so, 1 1 − R = 1 + R + R2 + R3 + · · · Exercise 5.8. Ch...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
] is a linear combination of the k previous output values, y[n − 1], . . . , y[n − k], j previous input values, x[n − 1], . . . , x[n − j], and the current input, x[n]. This class of state machines can be represented, in generality, in Python, using the LTISM class. The state is a tuple, containing a list of the j p...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
might, in algebra, define y = x + 6. Sometimes, however, we want to speak of the relationship between x and y in the general case, without a specific x or y in mind. We do this by defining a function f: f(x) = x + 6. We can do the same thing with LTI systems, by defining system functions. If we take the general form of...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
characterizes the operation of a system, independent of the particular input and output signals involved. The system function is most typically written in the form Y X = b0 + b1R + b2R2 + b3R3 + · · · a0 + a1R + a2R2 + a3R3 + · · · , Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 189 where c...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
our previous ones have been, is compositional, in the sense that whenever we make a new system function out of existing ones, it is a system function in its own right, which can be an element in further compositions. Addition The system function of the sum of two systems is the sum of their system functions. So, gi...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
combination, which results in a classical formula called Black’s formula. Consider two systems connected like this and pay careful attention to the negative sign on the feedback input to the addition. It is really just shorthand; the negative sign could be replaced with a gain component with value −1. This negativ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
more complex ones. We can provide a general characterization of the long-term behavior of the output, as increasing or decreasing, with constant or alternating sign, for any finite input to the system. We will begin by studying the unit-sample response of systems, and then generalize to more general input signals; ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
p0R + p0 2R2 + p0 3R3 + p0 4R4 + · · · . We can make intuitive sense of this by considering how the signal flows through the system. On each step, the output of the system is being fed back into the input. Consider the simple case where the input is the unit sample (X = ∆). Then, after step 0, when the input is 1, ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
sequence. The value of the pole, p0, determines the nature and rate of growth. • • • • If p0 < −1, the magnitude increases to infinity and the sign alternates. If −1 < p0 < 0, the magnitude decreases and the sign alternates. If 0 < p0 < 1, the magnitude decreases monotonically. If p0 > 1, the magnitude increases...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
systems. To do so, we need to find H1 and H2 such that H1H2 = H. We can do that by factoring H to get H1 = 1 1 − 0.7R and H2 = 1 1 − 0.9R . So, we have two equivalent version of this system, describable as cascades of two systems, one with p0 = 0.9 and one with p0 = 0.7: RR1.6−0.63+XY+0.9R+0.7RXYY2 Chapter 5...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
= A 1 − 0.9R + B 1 − 0.7R , multiply through by 1 − 1.6R + 0.63R2 to get 1 = A(1 − 0.7R) + B(1 − 0.9R) , and collect like terms: 1 = (A + B) − (0.7A + 0.9B)R . Equating the terms that involve equal powers of R (including constants as terms that involve R0), we have: 1 = A + B 0 = 0.7A + 0.9B . Solving, we fin...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
diagram, respectively. In this case, both of the poles (0.9 and 0.7) are less than 1, so the magnitude of the responses they generate decreases monotonically; their sum does not behave monotonically, but there is a time step at which the dominant pole completely dominates the other one, and the convergence is monot...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
Systems 6.01— Spring 2011— April 25, 2011 198 In these examples, as in the general case, the long-term unit-sample response of the entire system is governed by the unit-sample response of the mode whose pole has the larger magni­ tude. In the long run, the rate of growth of the exponential with the largest exponent...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
[n] . The position of a robot moving toward a wall might be described with difference equation: do[n] = do[n − 1] + KT do[n − 2] − KT di[n − 1] . Difference equations with real-valued coefficients generate real-valued outputs from real-valued inputs. But, like the difference equation y[n] = 2x[n] + 2x[n − 1] − 2y...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
Ω = r(cos Ω + j sin Ω) (cid:112) a2 + b2(cos(tan−1(b, a)) + j sin(tan−1(b, a))) = = (cid:112) a2 + b2( √ a a2 + b2 + j √ b a2 + b2 ) = a + bj Why should we bother with this change of representation? There are some operations on complex numbers that are much more straightforwardly done in the exponential repre...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
system generate behavior: they produce complex-valued modes. Remember that we can characterize the behavior of a mode as 1 1 − pR = 1 + pR + p 2R2 + · · · + p nRn + · · · . For a complex pole p = rejΩ, pn = rnejΩn. So 1 1 − rejΩR = 1 + rejΩR + r 2 ej2ΩR2 + · · · What happens as n tends to infinity when p is...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
20.20.40.60.81.0(cid:45)0.4(cid:45)0.20.20.40.60.81.0 Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 201 is the real value 1. The first signal clearly converges in magnitude to 0; the second one diverges (look carefully at the scales). p = 0.85ejπ/8 ≈ 0.785 + 0.325j p = 1.1ejπ/8 ≈ 1.016 + 0.421j I...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
(cid:112) (cid:112) a2 + b2 ej tan−1(±b,a) 2 + b2 e±j tan−1(b,a) a where the only difference is in the sign of the angular part. If we look at a second-order system with complex-conjugate poles, the resulting polynomial has real-valued coefficients. To see this, consider a system with poles rejΩ and re−jΩ, so that ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
j sin Ω)R + r 2R2 = 1 − 2r cos ΩR + r 2R2 So, Y X = 1 1 − 2r cos ΩR + r 2R2 . This is pretty cool! All of the imaginary parts cancel, and we are left with a system function with only real coefficients, which corresponds to the difference equation y[n] = x[n] + 2r cos Ω y[n − 1] − r 2 y[n − 2] . Additive decomp...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
nΩ + cot Ω sin nΩ) , which is entirely real. Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 203 The figures below show the modes for a system with poles 0.85ejπ/8 and 0.85e−jπ/8: the blue series starts at 1 2 (1 − j cot(π/8)) and traces out the unit sample response of the first component; the sec...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
1.0(cid:45)1.0(cid:45)0.50.51.0(cid:45)1.0(cid:45)0.50.51.0(cid:45)1.0(cid:45)0.50.51.0(cid:45)1.0(cid:45)0.50.51.0(cid:45)1.0(cid:45)0.50.51.0 Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 204 Just for fun, here is a three-dimensional plot of a single mode of a system with pole 0.98ejπ/20. These ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
the rate of growth or decay of the signal, as shown 1 + α2rn, for a system where r = 0.85, Ω = π/8, and below. The red and green curves are ± α = 2.414. √ (cid:45)1012re(cid:45)202im050100n(cid:45)1012re(cid:45)202im050100n(cid:45)1012re(cid:45)202im050100n Chapter 5 Signals and Systems 6.01— Spring 2011— April 25,...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
> 1, the magnitude increases monotonically to infinity. If p0 is complex • and |p0| < 1, the magnitude decreases monotonically. • and |p0| > 1, the magnitude increases monotonically to infinity. If p0 is complex and Ω is its angle, then the signal will be periodic, with period 2π/Ω. • • As we have seen in our exam...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
· · ) Y and construct an equivalent block diagram: Returning to the general polynomial ratio Y X = b0 + b1R + b2R2 + b3R3 + · · · 1 + a1R + a2R2 + a3R3 + · · · We can factor the denominator of an nth-order polynomial into n factors, and then perform a partial fraction expansion, to turn it into the form of a s...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
the behavior is going to be the sum of the behaviors of the individual modes, and that, as in the second-order case, the mode whose pole has the largest magnitude will govern the qualitative long-term nature of the behavior of the system in response to a unit-sample input. 5.5.4 Finding poles In general, we will fi...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
(1 − 4R)(1 − 3R) . so that our poles are 4 and 3. So, remember, the poles are not the roots of the polynomial in R, but are the roots of the polynomial in the reciprocal of R. +p0RC0+C1Rp1++D0D1R++············XYY1Y2 Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 208 The roots of a polynomial can...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
has a repeated pole; it is still possible to perform an additive decomposition, but it is somewhat trickier. Ultimately, however, it is still the magnitude of the largest root that governs the long-term convergence properties of the system. 5.5.5 Superposition The principle of superposition states that the response...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
R4)H∆. From this equation, it is easy to see that once we understand the unit-sample response of a system, we can see how it will respond to any finite input. We might be interested in understanding how a system H responds to a step input signal. Let’s just consider the basic step signal, U, defined as if n (cid:62)...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
goes to infinity, y[n] will converge to 1/(1 − p). We won’t study this in any further detail, but it’s useful to understand that the basis of our analy­ sis of systems applies very broadly across LTI systems and inputs. 5.6 Designing systems Will eventually include a discussion of root-locus plots. For now, see sec...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
1, then in response to a bounded input, the output signal will be bounded; in response to a transient input, it will converge to some constant value. If the dominant pole is real and positive, then in response to a transient input, the signal will, after finitely many steps, begin to increase or decrease monotonicall...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
• Output at step n is 2 times the input at step n − 2: y[n] = 2x[n − 2] dCoeffs: 0, 0, 2, cCoeffs: none • Output at step n is 2 times the output at step n − 1: y[n] = 2y[n − 1] dCoeffs: none, cCoeffs: 2 • Output at step n is the input at step n − 1 plus the output at step n − 2: y[n] = x[n − 1] + y[n − 2] dCoeffs: 0,...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
11— April 25, 2011 212 Find operator equations here; start by naming the signal that’s flowing between the two adders. Let’s call it W. Y = W − RW W = X + 2RW Now, rewrite the first equation as Y = (1 − R)W And the second one as W = X 1 − 2R Then, combine them to get Y = (1 − R) X 1 − 2R = 1 − R 1 − 2R X ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
Y(1 − 2R) = (1 − R)X Y = 1 − R 1 − 2R X So this system is equivalent to the original one. Let’s call the signal coming out of the first adder C. We get equations equivalent to H (yes/no)? NO Y = RC − RX C = X + RX So Y = R(X + RX) − RX = R2X which is not equivalent to the original system. Part b. Assume that the...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
wall at time n, Ds[n], and it desires to maintain a distance Di from the wall. The robot can execute velocity commands, and we program it to use this rule to set its forward velocity at time n, to be proportional to the error between Di and its current sensor reading. In this section, we’ll develop two different mo...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
we can describe the plant with the equation: do[n] = do[n − 1] − T v[n − 1] . That is, the new distance from the wall is equal to the old distance from the wall, minus the robot’s velocity towards the wall times the time interval of a step. In operator algebra terms, we have Do = RDo − T RV Do − RDo = −T RV Do(1 −...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
= −10 k = −11 k = −15 k = −18 k = −21 Generally speaking, the closer the magnitude of the dominant pole is to 0, the faster the system will converge. For this system, k = −10 is the ’perfect’ gain, which, in a perfect world, would make the robot jump, instantaneously, to the right place. This corresponds to havin...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
dark black, any value inside it has magnitude less than 1), and will cause divergence, and for the highest values of k it is also outside the unit circle and will also diverge. 5.8.3.2 Model 2: A delay in the sensor Now, we’ll consider a version of the problem in which there is a delay in the sensor, so that the co...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
of k, you can plug it into this formula and see what the values are. Remember that the pole with the largest magnitude will govern the long-term behavior of the system. Here are some plots of the evolution of the system, starting at distance 2.0, with an input Di = 0.7. k = 1 k = −1 k = −2.5 k = −3 k = −11 T = 0.1...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
There are two red points, corresponding to the conjugate pair of complex poles arising when k = −20. This system is unstable, because the magnitudes of those complex poles are greater than 1 (outside the unit circle). As we increase k, these poles move down; that is, their real part stays constant and the imaginary ...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
(on the earlier step) between the temperature of the object and the temperature of the environment, as well as to the length of the time step. Let • o[n] be temperature of object • s[n] be temperature of environment • T be the duration of a time step • K be the constant of proportionality Part a. Write a differen...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
Rk2(Z − RY) = Rk2(k1(X − RY) − RY) = k1k2RX − k1k2R2Y − k2R2Y Reorganizing terms, we have Y + k2(1 + k1)R2Y = k1k2RX RRR++k1k2XY−− Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 222 which leads us to the answer. Part b. Let k1 = 1 and k2 = −2. Assume that the system starts “at rest” (all sign...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf
, -2 For these k values, the denominator polynomial is 1 − 4R2 . So, we need to find the roots of the polynomial z2 − 4, which are ±2. Part d. For each of the systems below indicate whether the system is equivalent to this one: Chapter 5 Signals and Systems 6.01— Spring 2011— April 25, 2011 223 Let the output of...
https://ocw.mit.edu/courses/6-01sc-introduction-to-electrical-engineering-and-computer-science-i-spring-2011/1268f3289b19d628e9be3bd2ecfb4f44_MIT6_01SCS11_chap05.pdf