Skip to content
Browse files

More updates. Slight format change.

  • Loading branch information...
1 parent 17a7744 commit 0cc157fa308a01cee102f845b2234fc7675adf72 @steveWang committed
View
153 cs150.html
@@ -737,8 +737,157 @@
<p>Talk about quartz crystals, resonators. <mathjax>$\pi \cdot 10^7$</mathjax>.</p>
<p>So: before I let you go, parallel load, n bits in, serial out, etc.</p>
<p><a name='11'></a></p>
-<h1>CS 150: Digital Design &amp; Computer Architecture</h1>
-<h2>September 25, 2012</h2></div><div class='pos'></div>
+<h1>UART, MIPS and Timing</h1>
+<h2>September 25, 2012</h2>
+<p>Timing: motivation for next lecture (pipelining). Lot of online resources
+(resources, period) on MIPS. Should have lived + breathed this thing during
+61C. For sure, you've got your 61C lecture notes and CS150 lecture notes
+(both from last semester). Also the green card (reference) and there's
+obviously the book. Should have tons of material on the MIPS processor out
+there.</p>
+<p>So, from last time: we talked about a universal asynchronous receiver
+transmitter. On your homework, I want you to draw a couple of boxes
+(control and datapath; they exchange signals). Datapath is mostly shift
+registers. May be transmitting and receiving at same time; one may be idle;
+any mix. Some serial IO lines going to some other system not synchronized
+with you. Talked about clock and how much clock accuracy you need. For
+eight-bit, you need a couple percent matching parity. In years past, we've
+used N64 game controllers as input for the project. All they had was an RC
+relaxation oscillator. Had same format: start bit, two data bits, and stop
+bit. Data was sent Manchester-coded (0 -&gt; 01; 1: 10). In principle, I can
+have a 33% error, which is something I can do with an RC oscillator.</p>
+<p>Also part of the datapath, 8-bit data going in and out. Whatever, going to
+be MIPS interface. Set of memory-mapped addresses on the MIPS, so you can
+read/write on the serial port. Also some ready/valid stuff up
+here. Parallel data to/from MIPS datapath.</p>
+<p>MIPS: invented by our own Dave Patterson and John Henessey from
+Stanford. Started company, Kris saw business plan. Was confidential, now
+probably safe to talk about. Started off and said they're going to end up
+getting venture capital, and VCs going to take equity, which is going to
+dilute their equity. Simple solution, don't take venture money. These guys
+have seen enough of this. By the time they're all done, it would be awesome
+if they each had 4% of the company. They set things up so that they started
+at 4%. Were going to allocate 20% for all of the employees, series A going
+to take half, series B, they'll give up a third, and C, 15%. Interesting
+bit about MIPS that you didn't learn in 61C.</p>
+<p>One of the resources, the green sheet, once you've got this thing, you know
+a whole bunch about the processor. You know you've got a program counter
+over here, and you've got a register file in here, and how big it
+is. Obviously you've got an ALU and some data memory over here, and you
+know the instruction format. You don't explicitly know that you've got a
+separate instruction memory (that's a choice you get to make as an
+implementor); you don't know how many cycles it'll be (or pipelined,
+etc). People tend to have separate data and instruction memory for embedded
+systems, and locally, it looks like separate memories (even on more
+powerful systems).</p>
+<p>We haven't talked yet about what a register file looks like inside. Not
+absolute requirement about register file, but it would be nice if your
+register file had two read and one write address.</p>
+<p>We go from a D-ff, and we know that sticking an enable line on there lets
+us turn this into a D-ff with enable. Then if I string 32 of these in
+parallel, I now have a register (clocked), with a write-enable on it.</p>
+<p>Not going to talk about ALU today: probably after midterm.</p>
+<p>So now, I've got a set of 32 registers. Considerations of cost. Costs on
+the order of a hundredth of a cent.</p>
+<p>Now I've made my register file. How big is that logic? NAND gates to
+implement a 5-&gt;32 bit decoder.</p>
+<p>Asynchronous reads. At the rising edge of the clock, synchronous write.</p>
+<p>So, now we get back to MIPS review. The MIPS instrctions, you've got
+R/I/J-type instructions. All start with opcode (same length: 6 bits). Tiny
+fraction of all 32-bit instructions.</p>
+<p>More constraints as we get more stuff. If we then want to constrain that
+this is a single-cycle processor, then you end up with a pretty clear
+picture of what you want. PC doesn't need 32 bits (two LSBs are always 0);
+can implement PC with a counter.</p>
+<p>PC goes into instruction memory, and out comes my instruction. If, for
+example, we want to execute <code>LW $s0 12(%s3)</code>, then we look at the green
+card, and it tells us the RTL.</p>
+<p>Adding R-type to the I-type datapath adds three muxes. Not too bad.</p>
+<p><a name='12'></a></p>
+<h1>Pipelining</h1>
+<h2>September 27, 2012</h2>
+<p>Last time, I just mentioned in passing that we will always be reading
+32-bit instruction words in this class, but ARM has both 32- and 16-bit
+instruction sets. MicroMIPS does the same thing.</p>
+<p>Optimized for size rather than speed; will run at 100 MHz (not very good
+compared to desktop microprocessors made in the same process, which run in
+the gigahertz range), but it burns 3 mW. <mathjax>$0.06 \text{mm}^2$</mathjax>. Questions
+about power monitor -- you've got a chip that's somehow hanging off of the
+power plug and manages one way or the other to get a voltage and current
+signal. You know the voltage is going to look like 155 amplitude.</p>
+<p>Serial! Your serial line, the thing I want you to play around with is the
+receiver. We give this to you in the lab, but the thing is I want you to
+design the basic architecture.</p>
+<p>Start, stop, some bits between. You've got a counter on here that's running
+at 1024 ticks per bit of input. Eye diagrams.</p>
+<p>Notion of factoring state machines. Or you can draw 10000 states if you
+want.</p>
+<p>Something about Kris + scanners, it always ends badly. Will be putting
+lectures on the course website (and announce on Piazza). High-level, look
+at pipelines.</p>
+<p>MIPS pipeline</p>
+<p>For sure, you should be reading 7.5, if you haven't already. H&amp;H do a great
+job. Slightly different way of looking at pipelines, which is probably
+inferior, but it's different.</p>
+<p>First off, suppose I've got something like my Golden Bear power monitor,
+and <mathjax>$f = (A+B)C + D$</mathjax>. It's going to give me this ALU that does addition, ALU
+that does multiplication, and then an ALU that does addition again, and
+that will end up in my output register.</p>
+<p>There is a critical path (how fast can I clock this thing?). For now,
+assume "perfect" fast registers. This, however, is a bad assumption.</p>
+<p>So let's talk about propagation delay in registers.</p>
+<h2>Timing &amp; Delay (H&amp;H 3.5; Fig 3.35,36)</h2>
+<p>Suppose I have a simple edge-triggered D flipflop, and these things come
+with some specs on the input and output, and in particular, there is a
+setup time (<mathjax>$t_{\mathrm{setup}}$</mathjax>) and a hold time (<mathjax>$t_{\mathrm{hold}}$</mathjax>).</p>
+<p>On the FPGA, these are each like 0.4 ns, whereas in 22nm, these are more
+like 10 ps.</p>
+<p>And then the output is not going to change immediately (going to remain
+constant for some period of time before it changes), <mathjax>$t_{ccq}$</mathjax> is the
+minimum time for clock to contamination (change) in Q. And then there's a
+maximum called <mathjax>$t_{pcq}$</mathjax>, the maximum (worst-case) for clock to stable
+Q. Just parameters that you can't control (aside from choosing a different
+flipflop).</p>
+<p>So what do we want to do? We want to combine these flipflops through some
+combinational logic with some propagation delay (<mathjax>$t_{pd}$</mathjax>) and see what our
+constraints are going to be on the timing.</p>
+<p>Once the output is stable (<mathjax>$t_{pcq}$</mathjax>), it has to go through my
+combinational logic (<mathjax>$t_{pd}$</mathjax>), and then counting backwards, I've got
+<mathjax>$t_{setup}$</mathjax>, and that overall has to be less than my cycle. Tells you how
+complex logic can be, and how many stages of pipelines you need. Part of
+the story of selling microprocessors was clock speed. Some of the people
+who got bachelors in EE cared, but people only really bought the higher
+clock speeds. So there'd be like 4 NAND gate delays, and that was it. One
+of the reasons why Intel machines have such incredibly deep pipelines:
+everything was cut into pieces so they could have these clock speeds.</p>
+<p>So. <mathjax>$t_{pd}$</mathjax> on your Xilinx FPGA for block RAM, which you care about, is
+something like 2 ns from clock to data. 32-bit adders are also on the order
+of 2 ns. What you're likely to end up with is a 50 MHz part. I also have to
+worry about fast combinational logic -- what happens as the rising edge
+goes high, my new input contaminates, and it messes up this register before
+the setup time? Therefore <mathjax>$t_{ccq} + t_{pd} &gt; t_{hold}$</mathjax>, necessarily, so we
+need <mathjax>$t_{ccq} &gt; t_{hold}$</mathjax> for a good flipflop (consider shift registers,
+where we have basically no propagation delay).</p>
+<p>Therefore <mathjax>$t_{pcq} + t_{setup} + t_{pd} &lt; t_{cycle}$</mathjax>.</p>
+<p>What does this have to do with the flipflop we know about? If we look at
+the flipflop that we've done in the past (with inverters, controlled
+buffers, etc), what is <mathjax>$t_{setup}$</mathjax>? We have several delays; <mathjax>$t_{setup}$</mathjax>
+should ideally have D propagate to X and Y. How long is the hold
+afterwards? You'd like <mathjax>$D$</mathjax> to be constant for an inverter delay (so that it
+can stop having an effect). That's pretty stable. <mathjax>$t_{hold}$</mathjax> is something
+like the delay of an inverter (if you want to be really safe, you'd say
+twice that number). <mathjax>$t_{pcq}$</mathjax>, assuming we have valid setup, the D value
+will be sitting on Y, and we've got two inverter delays, and <mathjax>$t_{ccq}$</mathjax> is
+also 2 inverter delays.</p>
+<p>Good midterm-like question for you: if I have a flipflop with some
+characteristic setup and hold time, and I put a delay of 1 ps on the input,
+and I called this a new flipflop, how does that change any of these things?
+Can make <mathjax>$t_{hold}$</mathjax> negative. How do I add more delay? Just add more
+inverters in the front. Hold time can in fact go negative. Lot of 141-style
+stuff in here that you can play with.</p>
+<p>Given that, you have to deal with the fact that you've got this propagation
+time and the setup time. Cost of pipelined registers.</p>
+<p>Critical path time, various calculations.</p></div><div class='pos'></div>
<script src='mathjax/unpacked/MathJax.js?config=default'></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
View
260 ee221a.html
@@ -2,12 +2,12 @@
<p><a name='1'></a></p>
<h1>EE 221A: Linear System Theory</h1>
<h2>August 23, 2012</h2>
-<p>Prof. Claire Tomlin (tomlin@eecs)
-721 Sutardja Dai Hall
-inst.eecs.berkeley.edu/~ee221a</p>
-<p>GSI: Insoon Yang (iyang@eecs)</p>
-<p>Somewhat tentative office hours on schedule: T 1-2, W 11-12.</p>
-<p>In Soon's office hours: M 1:30 - 2:30, θ 11-12.</p>
+<h2>Administrivia</h2>
+<p>Prof. Claire Tomlin (tomlin@eecs). 721 Sutardja Dai Hall. Somewhat
+tentative office hours on schedule: T 1-2, W 11-12.
+http://inst.eecs.berkeley.edu/~ee221a</p>
+<p>GSI: Insoon Yang (iyang@eecs). In Soon's office hours: M 1:30 - 2:30, θ
+11-12.</p>
<p>Homeworks typically due on Thursday or Friday.</p>
<h2>Intro</h2>
<p>Bird's eye view of modeling in engineering + design vs. in science.</p>
@@ -119,7 +119,7 @@
then your model will work as expected. Simulation gives you system behavior
for a certain set of parameters. Very different, but they complement each
other. Analyze simpler models, simulate more complex models.</p>
-<h1>Linear Algebra</h1>
+<h2>Linear Algebra</h2>
<p>Functions and their properties.</p>
<p>Fields, vector spaces, properties and subspaces.</p>
<p>(note regarding notation: <mathjax>$\Re^+$</mathjax> means non-negative reals, as does
@@ -129,7 +129,7 @@
<p>Cartesian product: <mathjax>$\{(x,y) \vert x \in X \land y \in Y\}$</mathjax> (set of ordered
n-tuples)</p>
<p><a name='2'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Functions and Vector Spaces</h1>
<h2>August 28, 2012</h2>
<p>OH: M/W 5-6, 258 Cory</p>
<p>Today: beginning of the course: review of lin. alg topics needed for the
@@ -218,7 +218,7 @@
the main things we're going to do is look at properties of linear functions
and representation as multiplication by matrices.</p>
<p><a name='3'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Vector Spaces and Linearity</h1>
<h2>August 30, 2012</h2>
<h2>From last time</h2>
<p>Subspaces, bases, linear dependence/independence, linearity. One of the
@@ -286,7 +286,7 @@
<p>(if the nullspace only contains the zero vector, we say it is <strong>trivial</strong>)</p>
<p><mathjax>$$\mathcal{A}(x_0) = \mathcal{A}(x_1) \iff x - x_0 \in N(\mathcal{A})$$</mathjax></p>
<p><a name='4'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Matrix Representation of Linear Maps</h1>
<h2>September 4, 2012</h2>
<h2>Today</h2>
<p>Matrix multiplication as a representation of a linear map; change of basis
@@ -403,7 +403,7 @@
<p>From analysis: the <strong>supremum</strong> is the least upper bound (the smallest
<mathjax>$\forall y \in S, x : x \ge y$</mathjax>).</p>
<p><a name='5'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Guest Lecture: Induced Norms and Inner Products</h1>
<h2>September 6, 2012</h2>
<h2>Induced norms of matrices</h2>
<p>The reason that we're going to start talking about induced norms: today
@@ -595,7 +595,7 @@
<p>Basically, you get after all this computation that <mathjax>$b_2 = \frac{1}{12} t -
\frac{1}{24}$</mathjax>. Same construction for <mathjax>$b_3$</mathjax>.</p>
<p><a name='6'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Singular Value Decomposition &amp; Introduction to Differential Equations</h1>
<h2>September 11, 2012</h2>
<p>Reviewing the adjoint, suppose we have two vector spaces <mathjax>$U, V$</mathjax>; like we
have with norms, let us associated a field that is either <mathjax>$\Re$</mathjax> or
@@ -716,7 +716,7 @@
infinitely many points of discontinuity.</p>
<p>Next time we'll talk about Lipschitz continuity.</p>
<p><a name='7'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Existence and Uniqueness of Solutions to Differential Equations</h1>
<h2>September 13, 2012</h2>
<p>Section this Friday only, 9:30 - 110:30, Cory 299.</p>
<p>Today: existence and uniqueness of solutions to differential equations.</p>
@@ -854,7 +854,7 @@
a Cauchy sequence in a Banach space. Interestingly, it matters what norm
you choose.</p>
<p><a name='8'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Proof of Existence and Uniqueness Theorem</h1>
<h2>September 18, 2012</h2>
<p>Today:</p>
<ul>
@@ -1023,13 +1023,13 @@
time (and vice versa). You can't have solutions crossing themselves in
time-invariant systems.</p>
<p><a name='9'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Introduction to dynamical systems</h1>
<h2>September 20, 2012</h2>
-<p>Introduction to dynamical systems. Suppose we have equations <mathjax>$\dot{x} =
-f(x, u, t)$</mathjax>, <mathjax>$\fn{f}{\Re^n \times \Re^n \times \Re_+}{\Re^n}$</mathjax> and <mathjax>$y = h(x,
-u, t)$</mathjax>, <mathjax>$\fn{h}{\Re^n \times \Re^n \times \Re_+}{\Re^n}$</mathjax>. We define <mathjax>$n_i$</mathjax> as
-the dimension of the input space, <mathjax>$n_o$</mathjax> as dimension of the output space,
-and <mathjax>$n$</mathjax> as the dimension of the state space.</p>
+<p>Suppose we have equations <mathjax>$\dot{x} = f(x, u, t)$</mathjax>, <mathjax>$\fn{f}{\Re^n \times
+\Re^n \times \Re_+}{\Re^n}$</mathjax> and <mathjax>$y = h(x, u, t)$</mathjax>, <mathjax>$\fn{h}{\Re^n \times
+\Re^n \times \Re_+}{\Re^n}$</mathjax>. We define <mathjax>$n_i$</mathjax> as the dimension of the input
+space, <mathjax>$n_o$</mathjax> as dimension of the output space, and <mathjax>$n$</mathjax> as the dimension of
+the state space.</p>
<p>We've looked at the form, and if we specify a particular <mathjax>$\bar{u}(t)$</mathjax> over some
time interval of interest, then we can plug this into the right hand side
of this differential equation. Typically we do not supply a particular
@@ -1046,31 +1046,31 @@
our differential equation. Not formal, but practical for this example.</p>
<p>Notions of discretizing.</p>
<h2>What is a dynamical system?</h2>
-<p>As discussed in first lecture, we consider time <mathjax>$\Tau$</mathjax> to be a privileged
+<p>As discussed in first lecture, we consider time <mathjax>$\tau$</mathjax> to be a privileged
variable. Based on our definition of time, the inputs and outputs are all
functions of time.</p>
<p>Now we're going to define a <strong>dynamical system</strong> as a 5-tuple: <mathjax>$(\mathcal{U},
\Sigma, \mathcal{Y}, s, r)$</mathjax> (input space, state space, output space, state
transition function, output map).</p>
<p>We define the <strong>input space</strong> as the set of input functions over time to an
-input set <mathjax>$U$</mathjax> (i.e. <mathjax>$\mathcal{U} = \{\fn{u}{\Tau}{U}\}$</mathjax>. Typically, <mathjax>$U =
+input set <mathjax>$U$</mathjax> (i.e. <mathjax>$\mathcal{U} = \{\fn{u}{\tau}{U}\}$</mathjax>. Typically, <mathjax>$U =
\Re^{n_i}$</mathjax>).</p>
<p>We also define the <strong>output space</strong> as the set of output functions over time to
-an output set <mathjax>$Y$</mathjax> (i.e. <mathjax>$\mathcal{Y} = \{\fn{y}{\Tau}{Y}\}$</mathjax>). Typically, <mathjax>$Y
+an output set <mathjax>$Y$</mathjax> (i.e. <mathjax>$\mathcal{Y} = \{\fn{y}{\tau}{Y}\}$</mathjax>). Typically, <mathjax>$Y
= \Re^{n_o}$</mathjax>.</p>
<p><mathjax>$\Sigma$</mathjax> is our <strong>state space</strong>. Not defined as the function, but the actual
state space. Typically, <mathjax>$\Sigma = \Re^n$</mathjax>, and we can go back and think
-about the function <mathjax>$x(t) \in \Sigma$</mathjax>. <mathjax>$\fn{x}{\Tau}{\Sigma}$</mathjax> is called the
+about the function <mathjax>$x(t) \in \Sigma$</mathjax>. <mathjax>$\fn{x}{\tau}{\Sigma}$</mathjax> is called the
state trajectory.</p>
<p><mathjax>$s$</mathjax> is called the <strong>state transition function</strong> because it defines how the
state changes in response to time and the initial state and the
-input. <mathjax>$\fn{s}{\Tau \times \Tau \times \Sigma \times U }{\Sigma}$</mathjax>. Usually
+input. <mathjax>$\fn{s}{\tau \times \tau \times \Sigma \times U }{\Sigma}$</mathjax>. Usually
we write this as <mathjax>$x(t_1) = s(t_1, t_0, x_0, u)$</mathjax>, where <mathjax>$u$</mathjax> is the function
<mathjax>$u(\cdot) |_{t_0}^{t_1}$</mathjax>. This is important: coming towards how we define
state. Only things you need to get to state at the new time are the initial
state, inputs, and dynamics.</p>
<p>Finally, we have this <strong>output map</strong> (sometimes called the readout map)
-<mathjax>$r$</mathjax>. <mathjax>$\fn{r}{\Tau \times \Sigma \times U}{Y}$</mathjax>. That is, we can think about
+<mathjax>$r$</mathjax>. <mathjax>$\fn{r}{\tau \times \Sigma \times U}{Y}$</mathjax>. That is, we can think about
<mathjax>$y(t) = r(t, x(t), u(t))$</mathjax>. There's something fundamentally different
between <mathjax>$r$</mathjax> and <mathjax>$s$</mathjax>. <mathjax>$s$</mathjax> depended on the function <mathjax>$u$</mathjax>, whereas <mathjax>$r$</mathjax> only
depended on the current value of <mathjax>$u$</mathjax> at a particular time.</p>
@@ -1144,9 +1144,8 @@
\ge t_0, \rho(t, t_0, x_0, u) = \tilde{\rho}(t, t_0, \tilde{x_0}, u)$</mathjax>
<mathjax>$\forall x$</mathjax> and some <mathjax>$\tilde{x}$</mathjax>, the two systems are equivalent.</p>
<p><a name='10'></a></p>
-<h1>EE 221A: Linear System Theory</h1>
+<h1>Linear time-varying systems</h1>
<h2>September 25, 2012</h2>
-<h2>Linear time-varying systems</h2>
<p>Recall the state transition function is given some function of the current
time with initial state, initial time, and inputs, Suppose you have a
differential equation; how do you acquire the state transition function?
@@ -1221,16 +1220,16 @@
we can use the same machinery. If someone gives you a candidate solution,
you can easily show that it is the solution.</p>
<p>Recall the Leibniz rule, which we'll state in general as follows:
-<mathjax>$\pderiv{}{z} \int_{a(z)}^{b^z} f(x, z) dx = \int_{a(z)}^{b^z}
-\pderiv{}{x}f(x, z) dx + \pderiv{b}{z} f(b, z) - \pderiv{a}{z} f(a, z}$</mathjax>.</p>
+<mathjax>$\pderiv{}{z} \int_{a(z)}^{b(z)} f(x, z) dx = \int_{a(z)}^{b(z)}
+\pderiv{}{x}f(x, z) dx + \pderiv{b}{z} f(b, z) - \pderiv{a}{z} f(a, z)$</mathjax>.</p>
<p><mathjax>$$
-\dot{x}(t) &amp; = A(t) \Phi(t, t_0) x_0 + \int_{t_0}^t
+\dot{x}(t) = A(t) \Phi(t, t_0) x_0 + \int_{t_0}^t
\pderiv{}{t} \parens{\Phi(t, \tau)B(\tau)u(\tau)} d\tau +
\pderiv{t}{t}\parens{\Phi(t, t)B(t)u(t)} - \pderiv{t_0}{t}\parens{...}
-\\ &amp; = A(t)\Phi(t, t_0)x_0 + \int_{t_0}^t A(t)\Phi(t,\tau)B(\tau)u(\tau)d\tau + B(t)u(t)
-\\ &amp; = A(\tau)\Phi(t, t_0) x_0 + A(t)\int_{t_0}^t \Phi(t, \tau)B(\tau)
+\\ = A(t)\Phi(t, t_0)x_0 + \int_{t_0}^t A(t)\Phi(t,\tau)B(\tau)u(\tau)d\tau + B(t)u(t)
+\\ = A(\tau)\Phi(t, t_0) x_0 + A(t)\int_{t_0}^t \Phi(t, \tau)B(\tau)
u(\tau) d\tau + B(t) u(t)
-\\ &amp; = A(\tau)\parens{\Phi(t, t_0) x_0 + \int_{t_0}^t \Phi(t, \tau)B(\tau)
+\\ = A(\tau)\parens{\Phi(t, t_0) x_0 + \int_{t_0}^t \Phi(t, \tau)B(\tau)
u(\tau) d\tau} + B(t) u(t)
$$</mathjax></p>
<p><mathjax>$x(t) = \Phi(t,t_0)x_0 + \int_{t_0}^t \Phi(t,\tau)B(\tau)u(\tau) d\tau$</mathjax> is
@@ -1243,7 +1242,198 @@
time-invariance or time variance through the response map. But is it
linear? You have the state transition function, so we can compute the
response function (recall: readout map composed with the state transition
-function) and ask if this is a linear map.</p></div><div class='pos'></div>
+function) and ask if this is a linear map.</p>
+<p><a name='11'></a></p>
+<h1>Linear time-Invariant systems</h1>
+<h2>September 27, 2012</h2>
+<p>Last time, we talked about the time-varying differential equation, and we
+expressed <mathjax>$R(\cdot) = \bracks{A(\cdot), B(\cdot), C(\cdot),
+D(\cdot)}$</mathjax>. Used state transition matrix to show that the solution was
+given by <mathjax>$x(t) = \Phi(t, t_0) x_0 + \int_{t_0}^t B(\tau) u(\tau)
+d\tau$</mathjax>. Integral part is the state transition matrix, and we haven't
+talked about how we would compute this matrix. In general, computing the
+state transition matrix is hard. But there's one important class where
+computing that class becomes much simpler than usual. That is where the
+system does not depend on time.</p>
+<p>Linear time-invariant case: <mathjax>$\dot{x} = Ax + Bu, y = Cx + Du, x(t_0) =
+x_0$</mathjax>. Does not matter at what time we start. Typically, WLOG, we use <mathjax>$t_0 =
+0$</mathjax> (we can't do this in the time-varying case).</p>
+<h2>Aside: Jacobian linearization</h2>
+<p>In practice, generally the case that someone
+doesn't present you with a model that looks like this. Usually, you derive
+this (usually nonlinear) model through physics and whatnot. What can I do
+to come up with a linear representation of that system? What is typically
+done is an approximation technique called Jacobian linearization.</p>
+<p>So suppose someone gives you a nonlinear system and an output equation,
+and you want to come up with some linear representation of the system.</p>
+<p>Two points of view: we could look at the system, and suppose we applied a
+particular input to the system and solve the differential equation
+(<mathjax>$u^0(t) \mapsto x^0(t)$</mathjax>, the <strong>nominal input</strong> and <strong>nominal
+solution</strong>). That would result in a solution (<strong>state trajectory</strong>, in
+general). Now suppose that we for some reason want to perturb that input
+(<mathjax>$u^0(t) + \delta u(t)$</mathjax>, the <strong>perturbed input</strong>). Suppose in general
+that <mathjax>$\delta u$</mathjax> is a small perturbation. What this results in is a new
+state trajectory, that we'll define as <mathjax>$x^0(t) + \delta x(t)$</mathjax>, the
+<strong>perturbed solution</strong>.</p>
+<p>Now we can derive from that what we call the Jacobian linearization. That
+tells us that if we apply the input, the solution will be <mathjax>$x^0 =
+f(x^0, u^0, t)$</mathjax>, and I also have that <mathjax>$x^0(t_0) = x_0$</mathjax>.</p>
+<p><mathjax>$\dot{x}^0 + \dot{\delta}x = f(x^0 + \delta x, u^0 + \delta u, t)$</mathjax>, where
+<mathjax>$(x^0 + \delta x)(t_0) = x_0 + \delta x_0$</mathjax>. Now I'm going to look at these
+two and perform a Taylor expansion about the nominal input and
+solution. Thus <mathjax>$f(x^0 + \delta x, u^0 + \delta u, t) = f(x^0, u^0, t) +
+\pderiv{}{x} f(x, u, t)\vert_{(x^0, u^0)}\delta x +
+\pderiv{}{u}f(x,u,t)\vert_{(x^0, u^0)} \delta u + \text{higher order
+terms}$</mathjax> (recall that we also called <mathjax>$\pderiv{}{x}$</mathjax> <mathjax>$D_1$</mathjax>, i.e. the
+derivative with respect to the first argument).</p>
+<p>What I've done is expanded the right hand side of the differential
+equation. Thus <mathjax>$\delta x = \pderiv{}{x} f(x, u, t)\vert_{(x^0, u^0)} \delta
+x + \pderiv{}{u} f(...)\vert_{(x^0, y^0)}\delta u + ...$</mathjax>. If <mathjax>$\delta u,
+\delta x$</mathjax> small, then we can assume that they are approximately zero, which
+gives us an approximate first-order linear differential equation. This
+gives us a linear time-varying approximation of the dynamics of this
+perturbation vector, in response to a perturbation input. That's what the
+Jacobian linearization gives you: the perturbation away from the nominal
+(we linearized about a bias point).</p>
+<p>Consider A(t) to be the Jacobian matrix with respect to x, and B(t) to be
+the Jacobian matrix with respect to u. Remember that this is an
+approximation, and if your system is really nonlinear, and you perturb the
+system a lot (stray too far from the bias point), then this linearization
+may cease to hold.</p>
+<h2>Linear time-invariant systems</h2>
+<p>Motivated by the fact that we have a solution to the time-varying equation,
+it depends on the state transition matrix, which right now is an abstract
+thing which we don't have a way of solving. Let's go to a more specific
+class of systems: that where <mathjax>$A, B, C, D$</mathjax> do not depend on time. We know
+that this system is linear (we don't know yet that it is time-invariant; we
+have to find the response function and show that it satisfies the
+definition of a time-invariant system), so this still requires proof.</p>
+<p>Since these don't depend on time, we can use some familiar tools
+(e.g. Laplace transforms) and remember what taking the Laplace transform of
+a derivative is. Denote <mathjax>$\hat{x}(s)$</mathjax> to be the Laplace transform of
+<mathjax>$x(t)$</mathjax>. The Laplace transform is therefore <mathjax>$s\hat{x}(s) - x_0 = A\hat{x}(s)
++ B\hat{u}(s)$</mathjax>; <mathjax>$s\hat{y}(s) - y_0 = C\hat{x}(s) + D\hat{u}(s)$</mathjax>. The first
+equation becomes <mathjax>$(sI - A)\hat{x}(s) = x_0 + B\hat{u}(s)$</mathjax>, and we'll leave
+the second equation alone.</p>
+<p>Let's first consider <mathjax>$\hat{x} = Ax$</mathjax>, <mathjax>$x(0) = x_0$</mathjax>. I could have done the
+same thing, except my right hand side doesn't depend on B: <mathjax>$(sI -
+A)\hat{x}(s) = x_0$</mathjax>. Let's leave that for a second and come back to it, and
+make the following claim: the state transition matrix for <mathjax>$\hat{x} = Ax,
+x(t_0) = x_0$</mathjax> is <mathjax>$\Phi(t,t_0) = e^{A(t-t_0)}$</mathjax>, which is called the <strong>matrix
+exponential</strong>, defined as <mathjax>$e^{A(t-t_0)} = I + A(t-t_0) + \frac{A^2(t-t_0)^2}{2!}
++ ...$</mathjax> (Taylor expansion of the exponential function).</p>
+<p>We just need to show that the state transition matrix, using definitions we
+had last day, is indeed the state transition matrix for that system. We
+could go back to the definition of the state transition matrix for the
+system, or we could go back to the state transition function for the vector
+differential equation.</p>
+<p>From last time, we know that the solution to <mathjax>$\dot{x}A(t)x, x(t_0) = x_0$</mathjax>
+is given by <mathjax>$x(t) = \Phi(t, t_0)x_0$</mathjax>; here, we are claiming then that <mathjax>$x(t)
+= e^{A(t - t_0)} x_0$</mathjax>, where <mathjax>$x(t)$</mathjax> is the solution to <mathjax>$\dot{x} = Ax$</mathjax> with
+initial condition <mathjax>$x_0$</mathjax>.</p>
+<p>First show that it satisfies the vector differential equation: <mathjax>$\dot{x} =
+\pderiv{}{t}\exp\parens{A(t-t_0)} x_0 = (0 + A + A^2(t - t_0 + ...)x_0 =
+A(I + A(t-t_0) + \frac{A^2}{2}(t-t_0)^2 + ...) x_0 = Ae^{At} x_0 = Ax(t)$</mathjax>,
+so it satisfies the differential equation. Checking the initial condition,
+we get <mathjax>$e^{A \cdot 0}x_0 = I x_0 = x_0$</mathjax>. We've proven that this represents
+the solution to this time-invariant differential equation. By the existence
+and uniqueness theorem, this is the same solution.</p>
+<p>Through this proof, we've shown a couple of things: the derivative of the
+matrix exponential, and we evaluated it at <mathjax>$t-t_0=0$</mathjax>. So now let's go back
+and reconsider its infinite series representation and classify some of its
+other properties.</p>
+<h2>Properties of the matrix exponential</h2>
+<ul>
+<li><mathjax>$e^0 = I$</mathjax></li>
+<li><mathjax>$e^{A(t+s)} = e^{At}e^{As}$</mathjax></li>
+<li><mathjax>$e^{(A+B)t} = e^{At}e^{Bt}$</mathjax> iff <mathjax>$\comm{A}{B} = 0$</mathjax>.</li>
+<li><mathjax>$\parens{e^{At}}^{-1} = e^{-At}$</mathjax>, and these properties hold in general if
+ you're looking at <mathjax>$t$</mathjax> or <mathjax>$t - t_0$</mathjax>.</li>
+<li><mathjax>$\deriv{e^{At}}{t} = Ae^{At} = e^{At}A$</mathjax> (i.e. <mathjax>$\comm{e^At}{A} = 0$</mathjax>)</li>
+<li>Suppose <mathjax>$X(t) \in \Re^{n \times n}$</mathjax>, <mathjax>$\dot{X} = AX, X(0) = I$</mathjax>, then the
+ solution of this matrix differential equation and initial condition pair
+ is given by <mathjax>$X(t) = e^{At}$</mathjax>. Proof in the notes; very similar to what we
+ just did (more general proof, that the state transition matrix is just
+ given by the matrix exponential).</li>
+</ul>
+<h2>Calculating <mathjax>$e^{At}$</mathjax>, given <mathjax>$A$</mathjax></h2>
+<p>What this is now useful for is making more concrete this state transition
+concept. Still a little abstract, since we're still considering the
+exponential of a matrix.</p>
+<p>The first point is that using the infinite series representation to compute
+<mathjax>$e^{At}$</mathjax> is in general hard.</p>
+<p>Would be doable if you knew <mathjax>$A$</mathjax> were nilpotent (<mathjax>$A^k = 0$</mathjax> for some <mathjax>$k \in
+\mathbb{Z}$</mathjax>), but it's not always feasible. Would not be feasible if <mathjax>$k$</mathjax>
+large.</p>
+<p>The way one usually computes the state transition matrix <mathjax>$e^{At}$</mathjax> is as
+follows:</p>
+<p>Recall: <mathjax>$\dot{X}(t) = AX(t)$</mathjax>, with <mathjax>$X(0) = I$</mathjax>. We know from what we've done
+before (property 6) that we can easily prove <mathjax>$X(t) = e^{At}$</mathjax>. We also know
+that <mathjax>$(sI - A)\hat{X}(s) = I$</mathjax>, so <mathjax>$\hat{X}(s) = (sI - A)^{-1}$</mathjax>. That tells
+me that <mathjax>$e^{At} = \mathcal{L}^{-1}\parens{(sI - A)^{-1}}$</mathjax>. That gives us a
+way of computing <mathjax>$e^{At}$</mathjax>, assuming we have a way to compute a matrix's
+inverse and an inverse Laplace transform. This is what people usually do,
+and most algorithms approach the problem this way. Generally hard to
+compute the inverse and the inverse Laplace transform.</p>
+<p>Requires proof regarding why <mathjax>$sI - A$</mathjax> always has an inverse given by
+<mathjax>$e^{-At}$</mathjax>.</p>
+<p>Clive Moller started LINPACK (Linear algebra package; engine behind
+MATLAB). Famous in computational linear algebra. Paper: 19 dubious ways to
+compute the matrix exponential. Actually a hard problem in
+general. Factoring of <mathjax>$n$</mathjax>-degree polynomials.</p>
+<p>If we were to consider our simple nilpotent case, we'll compute <mathjax>$sI - A =
+\begin{bmatrix}s &amp; -1 \\ 0 &amp; s\end{bmatrix}$</mathjax>. We can immediately write down
+its inverse as <mathjax>$\begin{bmatrix}\frac{1}{s} &amp; \frac{1}{s^2} \\ 0 &amp;
+\frac{1}{s}\end{bmatrix}$</mathjax>. Inverse Laplace transform takes no work; it's
+simply <mathjax>$\begin{bmatrix}1 &amp; t \\ 0 &amp; 1\end{bmatrix}$</mathjax>.</p>
+<p>In the next lecture (and next series of lectures) we will be talking about
+the Jordan form of a matrix. We have a way to compute <mathjax>$e^{At}$</mathjax>. We'll write
+<mathjax>$A = TJT^{-1}$</mathjax>. In its simplest case, it's diagonal. Either way, all of the
+work is in exponentiating <mathjax>$J$</mathjax>. You still end up doing something that's the
+inverse Laplace transform of <mathjax>$sI - J$</mathjax>.</p>
+<p>We've shown that for a linear TI system, <mathjax>$\dot{x} = Ax + Bu$</mathjax>; <mathjax>$y = Cx + Du$</mathjax>
+(<mathjax>$x(0) = x_0$</mathjax>). <mathjax>$x(t) = e^{At}x_0 + \int_0^t e^{A(t-\tau)} Bu(\tau)
+d\tau$</mathjax>. We proved it last time, but you can check this satisfies the
+differential equation and initial condition.</p>
+<p>From that, you can compute the response function and show that it's
+time-invariant. Let's conclude today's class with a planar inverted
+pendulum. Let's call the angle of rotation away from the vertical <mathjax>$\theta$</mathjax>,
+mass <mathjax>$m$</mathjax>, length <mathjax>$\ell$</mathjax>, and torque <mathjax>$\tau$</mathjax>. Equations of motion: <mathjax>$m\ell^2
+\ddot{\theta} - mg\ell \sin \theta = \tau$</mathjax>. Perform Jacobian
+linearization; we'll define <mathjax>$\theta = 0$</mathjax> at <mathjax>$\pi/2$</mathjax>, and we're linearizing
+about the trivial trajectory that the pendulum is straight up. Therefore
+<mathjax>$\delta \theta = \theta \implies m\ell^2 \ddot{\theta} + mg\ell\theta
+= \tau$</mathjax>, where <mathjax>$u = \frac{\tau}{m\ell^2}$</mathjax>, and <mathjax>$\Omega^2 = \frac{g}{\ell}$</mathjax>,
+<mathjax>$\dot{x}_1 = x_2$</mathjax>, and <mathjax>$\dot{x}_2 = \Omega^2 x_1 + u$</mathjax>.</p>
+<p><mathjax>$y = \theta - x_1, \dot{x}_1 = x_2, \dot{x}_2 = \Omega^2 x_1 + u, y =
+x_1$</mathjax>. Stabilization of system via feedback by considering poles of Laplace
+transform, etc. <mathjax>$\frac{\hat{y}}{\hat{u}} = \frac{1}{s^2 - \Omega^2} =
+G(s)$</mathjax> (the plant).</p>
+<p>In general, not a good idea: canceling unstable pole, and then using
+feedback. In the notes, this is some controller <mathjax>$K(s)$</mathjax>. If we look at the
+open-loop transfer function (<mathjax>$K(s)G(s) = \frac{1}{s(s+\Omega)}$</mathjax>), <mathjax>$u =
+\frac{s-\Omega}{s}\bar{u}$</mathjax>, so <mathjax>$\dot{u} = \dot{\bar{u}} - \Omega\bar{u}$</mathjax>
+(assume zero initial conditions on <mathjax>$u, \bar{u}$</mathjax>). If we define a third
+state variable now, <mathjax>$x_3 = u - \bar{u}$</mathjax>, then that tells us that <mathjax>$\dot{x}_3
+= \Omega \bar{u}$</mathjax>. Here, I have <mathjax>$A = \begin{bmatrix} 0 &amp; 1 &amp; 0 \\ \Omega^2
+&amp; 0 &amp; -1 \\ 0 &amp; 0 &amp; 0 \end{bmatrix}$</mathjax>, <mathjax>$B = \begin{bmatrix}0 \\ 1 \\
+\Omega\end{bmatrix}$</mathjax>, <mathjax>$C = \begin{bmatrix}1 &amp; 0 &amp; 0\end{bmatrix}$</mathjax>, <mathjax>$D =
+0$</mathjax>. Out of time today, but we'll solve at the beginning of Tuesday's class.</p>
+<p>Solve for <mathjax>$x(t) = \begin{bmatrix}x_1, x_2, x_3\end{bmatrix}$</mathjax>. We have a few
+approaches:</p>
+<ul>
+<li>Using <mathjax>$A,B,C,D$</mathjax>: compute the following: <mathjax>$y(t) = Ce^{At} x_0 + C\int_0^t
+ e^{A(t - \tau)}Bu(\tau) d\tau$</mathjax>. In doing that, we'll need to compute
+ <mathjax>$e^{At}$</mathjax>, and then we have this expression for general <mathjax>$u$</mathjax>: suppose you
+ supply a step input.</li>
+<li>Suppose <mathjax>$\bar{u} = -y = -Cx$</mathjax>. Therefore <mathjax>$\dot{x} = Ax + B(-Cx) = (A -
+ BC)x$</mathjax>. We have a new <mathjax>$A_{CL} = A - BC$</mathjax>, and we can exponentiate this
+ instead.</li>
+</ul>
+<p>Foreshadows later, when we think about control. Introduces this standard
+notion of feedback for stabilizing systems. Using newfound knowledge of
+state transition matrix for TI systems (how to compute it), see how to
+compute. See what MATLAB is doing.</p></div><div class='pos'></div>
<script src='mathjax/unpacked/MathJax.js?config=default'></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Register.StartupHook("TeX Jax Ready",function () {
View
82 fa2012/cs150/11.md
@@ -1,5 +1,83 @@
-CS 150: Digital Design & Computer Architecture
-==============================================
+UART, MIPS and Timing
+=====================
September 25, 2012
------------------
+Timing: motivation for next lecture (pipelining). Lot of online resources
+(resources, period) on MIPS. Should have lived + breathed this thing during
+61C. For sure, you've got your 61C lecture notes and CS150 lecture notes
+(both from last semester). Also the green card (reference) and there's
+obviously the book. Should have tons of material on the MIPS processor out
+there.
+
+So, from last time: we talked about a universal asynchronous receiver
+transmitter. On your homework, I want you to draw a couple of boxes
+(control and datapath; they exchange signals). Datapath is mostly shift
+registers. May be transmitting and receiving at same time; one may be idle;
+any mix. Some serial IO lines going to some other system not synchronized
+with you. Talked about clock and how much clock accuracy you need. For
+eight-bit, you need a couple percent matching parity. In years past, we've
+used N64 game controllers as input for the project. All they had was an RC
+relaxation oscillator. Had same format: start bit, two data bits, and stop
+bit. Data was sent Manchester-coded (0 -> 01; 1: 10). In principle, I can
+have a 33% error, which is something I can do with an RC oscillator.
+
+Also part of the datapath, 8-bit data going in and out. Whatever, going to
+be MIPS interface. Set of memory-mapped addresses on the MIPS, so you can
+read/write on the serial port. Also some ready/valid stuff up
+here. Parallel data to/from MIPS datapath.
+
+MIPS: invented by our own Dave Patterson and John Henessey from
+Stanford. Started company, Kris saw business plan. Was confidential, now
+probably safe to talk about. Started off and said they're going to end up
+getting venture capital, and VCs going to take equity, which is going to
+dilute their equity. Simple solution, don't take venture money. These guys
+have seen enough of this. By the time they're all done, it would be awesome
+if they each had 4% of the company. They set things up so that they started
+at 4%. Were going to allocate 20% for all of the employees, series A going
+to take half, series B, they'll give up a third, and C, 15%. Interesting
+bit about MIPS that you didn't learn in 61C.
+
+One of the resources, the green sheet, once you've got this thing, you know
+a whole bunch about the processor. You know you've got a program counter
+over here, and you've got a register file in here, and how big it
+is. Obviously you've got an ALU and some data memory over here, and you
+know the instruction format. You don't explicitly know that you've got a
+separate instruction memory (that's a choice you get to make as an
+implementor); you don't know how many cycles it'll be (or pipelined,
+etc). People tend to have separate data and instruction memory for embedded
+systems, and locally, it looks like separate memories (even on more
+powerful systems).
+
+We haven't talked yet about what a register file looks like inside. Not
+absolute requirement about register file, but it would be nice if your
+register file had two read and one write address.
+
+We go from a D-ff, and we know that sticking an enable line on there lets
+us turn this into a D-ff with enable. Then if I string 32 of these in
+parallel, I now have a register (clocked), with a write-enable on it.
+
+Not going to talk about ALU today: probably after midterm.
+
+So now, I've got a set of 32 registers. Considerations of cost. Costs on
+the order of a hundredth of a cent.
+
+Now I've made my register file. How big is that logic? NAND gates to
+implement a 5->32 bit decoder.
+
+Asynchronous reads. At the rising edge of the clock, synchronous write.
+
+So, now we get back to MIPS review. The MIPS instrctions, you've got
+R/I/J-type instructions. All start with opcode (same length: 6 bits). Tiny
+fraction of all 32-bit instructions.
+
+More constraints as we get more stuff. If we then want to constrain that
+this is a single-cycle processor, then you end up with a pretty clear
+picture of what you want. PC doesn't need 32 bits (two LSBs are always 0);
+can implement PC with a counter.
+
+PC goes into instruction memory, and out comes my instruction. If, for
+example, we want to execute `LW $s0 12(%s3)`, then we look at the green
+card, and it tells us the RTL.
+
+Adding R-type to the I-type datapath adds three muxes. Not too bad.
View
108 fa2012/cs150/12.md
@@ -0,0 +1,108 @@
+Pipelining
+==========
+September 27, 2012
+------------------
+Last time, I just mentioned in passing that we will always be reading
+32-bit instruction words in this class, but ARM has both 32- and 16-bit
+instruction sets. MicroMIPS does the same thing.
+
+Optimized for size rather than speed; will run at 100 MHz (not very good
+compared to desktop microprocessors made in the same process, which run in
+the gigahertz range), but it burns 3 mW. $0.06 \text{mm}^2$. Questions
+about power monitor -- you've got a chip that's somehow hanging off of the
+power plug and manages one way or the other to get a voltage and current
+signal. You know the voltage is going to look like 155 amplitude.
+
+Serial! Your serial line, the thing I want you to play around with is the
+receiver. We give this to you in the lab, but the thing is I want you to
+design the basic architecture.
+
+Start, stop, some bits between. You've got a counter on here that's running
+at 1024 ticks per bit of input. Eye diagrams.
+
+Notion of factoring state machines. Or you can draw 10000 states if you
+want.
+
+Something about Kris + scanners, it always ends badly. Will be putting
+lectures on the course website (and announce on Piazza). High-level, look
+at pipelines.
+
+MIPS pipeline
+
+For sure, you should be reading 7.5, if you haven't already. H&H do a great
+job. Slightly different way of looking at pipelines, which is probably
+inferior, but it's different.
+
+First off, suppose I've got something like my Golden Bear power monitor,
+and $f = (A+B)C + D$. It's going to give me this ALU that does addition, ALU
+that does multiplication, and then an ALU that does addition again, and
+that will end up in my output register.
+
+There is a critical path (how fast can I clock this thing?). For now,
+assume "perfect" fast registers. This, however, is a bad assumption.
+
+So let's talk about propagation delay in registers.
+
+Timing & Delay (H&H 3.5; Fig 3.35,36)
+-------------------------------------
+Suppose I have a simple edge-triggered D flipflop, and these things come
+with some specs on the input and output, and in particular, there is a
+setup time ($t_{\mathrm{setup}}$) and a hold time ($t_{\mathrm{hold}}$).
+
+On the FPGA, these are each like 0.4 ns, whereas in 22nm, these are more
+like 10 ps.
+
+And then the output is not going to change immediately (going to remain
+constant for some period of time before it changes), $t_{ccq}$ is the
+minimum time for clock to contamination (change) in Q. And then there's a
+maximum called $t_{pcq}$, the maximum (worst-case) for clock to stable
+Q. Just parameters that you can't control (aside from choosing a different
+flipflop).
+
+So what do we want to do? We want to combine these flipflops through some
+combinational logic with some propagation delay ($t_{pd}$) and see what our
+constraints are going to be on the timing.
+
+Once the output is stable ($t_{pcq}$), it has to go through my
+combinational logic ($t_{pd}$), and then counting backwards, I've got
+$t_{setup}$, and that overall has to be less than my cycle. Tells you how
+complex logic can be, and how many stages of pipelines you need. Part of
+the story of selling microprocessors was clock speed. Some of the people
+who got bachelors in EE cared, but people only really bought the higher
+clock speeds. So there'd be like 4 NAND gate delays, and that was it. One
+of the reasons why Intel machines have such incredibly deep pipelines:
+everything was cut into pieces so they could have these clock speeds.
+
+So. $t_{pd}$ on your Xilinx FPGA for block RAM, which you care about, is
+something like 2 ns from clock to data. 32-bit adders are also on the order
+of 2 ns. What you're likely to end up with is a 50 MHz part. I also have to
+worry about fast combinational logic -- what happens as the rising edge
+goes high, my new input contaminates, and it messes up this register before
+the setup time? Therefore $t_{ccq} + t_{pd} > t_{hold}$, necessarily, so we
+need $t_{ccq} > t_{hold}$ for a good flipflop (consider shift registers,
+where we have basically no propagation delay).
+
+Therefore $t_{pcq} + t_{setup} + t_{pd} < t_{cycle}$.
+
+What does this have to do with the flipflop we know about? If we look at
+the flipflop that we've done in the past (with inverters, controlled
+buffers, etc), what is $t_{setup}$? We have several delays; $t_{setup}$
+should ideally have D propagate to X and Y. How long is the hold
+afterwards? You'd like $D$ to be constant for an inverter delay (so that it
+can stop having an effect). That's pretty stable. $t_{hold}$ is something
+like the delay of an inverter (if you want to be really safe, you'd say
+twice that number). $t_{pcq}$, assuming we have valid setup, the D value
+will be sitting on Y, and we've got two inverter delays, and $t_{ccq}$ is
+also 2 inverter delays.
+
+Good midterm-like question for you: if I have a flipflop with some
+characteristic setup and hold time, and I put a delay of 1 ps on the input,
+and I called this a new flipflop, how does that change any of these things?
+Can make $t_{hold}$ negative. How do I add more delay? Just add more
+inverters in the front. Hold time can in fact go negative. Lot of 141-style
+stuff in here that you can play with.
+
+Given that, you have to deal with the fact that you've got this propagation
+time and the setup time. Cost of pipelined registers.
+
+Critical path time, various calculations.
View
193 fa2012/cs150/cs150.md
@@ -974,8 +974,197 @@ So: before I let you go, parallel load, n bits in, serial out, etc.
<a name='11'></a>
-CS 150: Digital Design & Computer Architecture
-==============================================
+UART, MIPS and Timing
+=====================
September 25, 2012
------------------
+Timing: motivation for next lecture (pipelining). Lot of online resources
+(resources, period) on MIPS. Should have lived + breathed this thing during
+61C. For sure, you've got your 61C lecture notes and CS150 lecture notes
+(both from last semester). Also the green card (reference) and there's
+obviously the book. Should have tons of material on the MIPS processor out
+there.
+
+So, from last time: we talked about a universal asynchronous receiver
+transmitter. On your homework, I want you to draw a couple of boxes
+(control and datapath; they exchange signals). Datapath is mostly shift
+registers. May be transmitting and receiving at same time; one may be idle;
+any mix. Some serial IO lines going to some other system not synchronized
+with you. Talked about clock and how much clock accuracy you need. For
+eight-bit, you need a couple percent matching parity. In years past, we've
+used N64 game controllers as input for the project. All they had was an RC
+relaxation oscillator. Had same format: start bit, two data bits, and stop
+bit. Data was sent Manchester-coded (0 -> 01; 1: 10). In principle, I can
+have a 33% error, which is something I can do with an RC oscillator.
+
+Also part of the datapath, 8-bit data going in and out. Whatever, going to
+be MIPS interface. Set of memory-mapped addresses on the MIPS, so you can
+read/write on the serial port. Also some ready/valid stuff up
+here. Parallel data to/from MIPS datapath.
+
+MIPS: invented by our own Dave Patterson and John Henessey from
+Stanford. Started company, Kris saw business plan. Was confidential, now
+probably safe to talk about. Started off and said they're going to end up
+getting venture capital, and VCs going to take equity, which is going to
+dilute their equity. Simple solution, don't take venture money. These guys
+have seen enough of this. By the time they're all done, it would be awesome
+if they each had 4% of the company. They set things up so that they started
+at 4%. Were going to allocate 20% for all of the employees, series A going
+to take half, series B, they'll give up a third, and C, 15%. Interesting
+bit about MIPS that you didn't learn in 61C.
+
+One of the resources, the green sheet, once you've got this thing, you know
+a whole bunch about the processor. You know you've got a program counter
+over here, and you've got a register file in here, and how big it
+is. Obviously you've got an ALU and some data memory over here, and you
+know the instruction format. You don't explicitly know that you've got a
+separate instruction memory (that's a choice you get to make as an
+implementor); you don't know how many cycles it'll be (or pipelined,
+etc). People tend to have separate data and instruction memory for embedded
+systems, and locally, it looks like separate memories (even on more
+powerful systems).
+
+We haven't talked yet about what a register file looks like inside. Not
+absolute requirement about register file, but it would be nice if your
+register file had two read and one write address.
+
+We go from a D-ff, and we know that sticking an enable line on there lets
+us turn this into a D-ff with enable. Then if I string 32 of these in
+parallel, I now have a register (clocked), with a write-enable on it.
+
+Not going to talk about ALU today: probably after midterm.
+
+So now, I've got a set of 32 registers. Considerations of cost. Costs on
+the order of a hundredth of a cent.
+
+Now I've made my register file. How big is that logic? NAND gates to
+implement a 5->32 bit decoder.
+
+Asynchronous reads. At the rising edge of the clock, synchronous write.
+
+So, now we get back to MIPS review. The MIPS instrctions, you've got
+R/I/J-type instructions. All start with opcode (same length: 6 bits). Tiny
+fraction of all 32-bit instructions.
+
+More constraints as we get more stuff. If we then want to constrain that
+this is a single-cycle processor, then you end up with a pretty clear
+picture of what you want. PC doesn't need 32 bits (two LSBs are always 0);
+can implement PC with a counter.
+
+PC goes into instruction memory, and out comes my instruction. If, for
+example, we want to execute `LW $s0 12(%s3)`, then we look at the green
+card, and it tells us the RTL.
+
+Adding R-type to the I-type datapath adds three muxes. Not too bad.
+
+<a name='12'></a>
+
+Pipelining
+==========
+September 27, 2012
+------------------
+Last time, I just mentioned in passing that we will always be reading
+32-bit instruction words in this class, but ARM has both 32- and 16-bit
+instruction sets. MicroMIPS does the same thing.
+
+Optimized for size rather than speed; will run at 100 MHz (not very good
+compared to desktop microprocessors made in the same process, which run in
+the gigahertz range), but it burns 3 mW. $0.06 \text{mm}^2$. Questions
+about power monitor -- you've got a chip that's somehow hanging off of the
+power plug and manages one way or the other to get a voltage and current
+signal. You know the voltage is going to look like 155 amplitude.
+
+Serial! Your serial line, the thing I want you to play around with is the
+receiver. We give this to you in the lab, but the thing is I want you to
+design the basic architecture.
+
+Start, stop, some bits between. You've got a counter on here that's running
+at 1024 ticks per bit of input. Eye diagrams.
+
+Notion of factoring state machines. Or you can draw 10000 states if you
+want.
+
+Something about Kris + scanners, it always ends badly. Will be putting
+lectures on the course website (and announce on Piazza). High-level, look
+at pipelines.
+
+MIPS pipeline
+
+For sure, you should be reading 7.5, if you haven't already. H&H do a great
+job. Slightly different way of looking at pipelines, which is probably
+inferior, but it's different.
+
+First off, suppose I've got something like my Golden Bear power monitor,
+and $f = (A+B)C + D$. It's going to give me this ALU that does addition, ALU
+that does multiplication, and then an ALU that does addition again, and
+that will end up in my output register.
+
+There is a critical path (how fast can I clock this thing?). For now,
+assume "perfect" fast registers. This, however, is a bad assumption.
+
+So let's talk about propagation delay in registers.
+
+Timing & Delay (H&H 3.5; Fig 3.35,36)
+-------------------------------------
+Suppose I have a simple edge-triggered D flipflop, and these things come
+with some specs on the input and output, and in particular, there is a
+setup time ($t_{\mathrm{setup}}$) and a hold time ($t_{\mathrm{hold}}$).
+
+On the FPGA, these are each like 0.4 ns, whereas in 22nm, these are more
+like 10 ps.
+
+And then the output is not going to change immediately (going to remain
+constant for some period of time before it changes), $t_{ccq}$ is the
+minimum time for clock to contamination (change) in Q. And then there's a
+maximum called $t_{pcq}$, the maximum (worst-case) for clock to stable
+Q. Just parameters that you can't control (aside from choosing a different
+flipflop).
+
+So what do we want to do? We want to combine these flipflops through some
+combinational logic with some propagation delay ($t_{pd}$) and see what our
+constraints are going to be on the timing.
+
+Once the output is stable ($t_{pcq}$), it has to go through my
+combinational logic ($t_{pd}$), and then counting backwards, I've got
+$t_{setup}$, and that overall has to be less than my cycle. Tells you how
+complex logic can be, and how many stages of pipelines you need. Part of
+the story of selling microprocessors was clock speed. Some of the people
+who got bachelors in EE cared, but people only really bought the higher
+clock speeds. So there'd be like 4 NAND gate delays, and that was it. One
+of the reasons why Intel machines have such incredibly deep pipelines:
+everything was cut into pieces so they could have these clock speeds.
+
+So. $t_{pd}$ on your Xilinx FPGA for block RAM, which you care about, is
+something like 2 ns from clock to data. 32-bit adders are also on the order
+of 2 ns. What you're likely to end up with is a 50 MHz part. I also have to
+worry about fast combinational logic -- what happens as the rising edge
+goes high, my new input contaminates, and it messes up this register before
+the setup time? Therefore $t_{ccq} + t_{pd} > t_{hold}$, necessarily, so we
+need $t_{ccq} > t_{hold}$ for a good flipflop (consider shift registers,
+where we have basically no propagation delay).
+
+Therefore $t_{pcq} + t_{setup} + t_{pd} < t_{cycle}$.
+
+What does this have to do with the flipflop we know about? If we look at
+the flipflop that we've done in the past (with inverters, controlled
+buffers, etc), what is $t_{setup}$? We have several delays; $t_{setup}$
+should ideally have D propagate to X and Y. How long is the hold
+afterwards? You'd like $D$ to be constant for an inverter delay (so that it
+can stop having an effect). That's pretty stable. $t_{hold}$ is something
+like the delay of an inverter (if you want to be really safe, you'd say
+twice that number). $t_{pcq}$, assuming we have valid setup, the D value
+will be sitting on Y, and we've got two inverter delays, and $t_{ccq}$ is
+also 2 inverter delays.
+
+Good midterm-like question for you: if I have a flipflop with some
+characteristic setup and hold time, and I put a delay of 1 ps on the input,
+and I called this a new flipflop, how does that change any of these things?
+Can make $t_{hold}$ negative. How do I add more delay? Just add more
+inverters in the front. Hold time can in fact go negative. Lot of 141-style
+stuff in here that you can play with.
+
+Given that, you have to deal with the fact that you've got this propagation
+time and the setup time. Cost of pipelined registers.
+
+Critical path time, various calculations.
View
18 fa2012/ee221a/1.md
@@ -2,16 +2,14 @@ EE 221A: Linear System Theory
=============================
August 23, 2012
---------------
+Administrivia
+-------------
+Prof. Claire Tomlin (tomlin@eecs). 721 Sutardja Dai Hall. Somewhat
+tentative office hours on schedule: T 1-2, W 11-12.
+http://inst.eecs.berkeley.edu/~ee221a
-Prof. Claire Tomlin (tomlin@eecs)
-721 Sutardja Dai Hall
-inst.eecs.berkeley.edu/~ee221a
-
-GSI: Insoon Yang (iyang@eecs)
-
-Somewhat tentative office hours on schedule: T 1-2, W 11-12.
-
-In Soon's office hours: M 1:30 - 2:30, θ 11-12.
+GSI: Insoon Yang (iyang@eecs). In Soon's office hours: M 1:30 - 2:30, θ
+11-12.
Homeworks typically due on Thursday or Friday.
@@ -154,7 +152,7 @@ for a certain set of parameters. Very different, but they complement each
other. Analyze simpler models, simulate more complex models.
Linear Algebra
-==============
+--------------
Functions and their properties.
Fields, vector spaces, properties and subspaces.
View
18 fa2012/ee221a/10.md
@@ -1,9 +1,7 @@
-EE 221A: Linear System Theory
-=============================
+Linear time-varying systems
+===========================
September 25, 2012
------------------
-Linear time-varying systems
----------------------------
Recall the state transition function is given some function of the current
time with initial state, initial time, and inputs, Suppose you have a
differential equation; how do you acquire the state transition function?
@@ -94,17 +92,17 @@ we can use the same machinery. If someone gives you a candidate solution,
you can easily show that it is the solution.
Recall the Leibniz rule, which we'll state in general as follows:
-$\pderiv{}{z} \int_{a(z)}^{b^z} f(x, z) dx = \int_{a(z)}^{b^z}
-\pderiv{}{x}f(x, z) dx + \pderiv{b}{z} f(b, z) - \pderiv{a}{z} f(a, z}$.
+$\pderiv{}{z} \int_{a(z)}^{b(z)} f(x, z) dx = \int_{a(z)}^{b(z)}
+\pderiv{}{x}f(x, z) dx + \pderiv{b}{z} f(b, z) - \pderiv{a}{z} f(a, z)$.
$$
-\dot{x}(t) & = A(t) \Phi(t, t_0) x_0 + \int_{t_0}^t
+\dot{x}(t) = A(t) \Phi(t, t_0) x_0 + \int_{t_0}^t
\pderiv{}{t} \parens{\Phi(t, \tau)B(\tau)u(\tau)} d\tau +
\pderiv{t}{t}\parens{\Phi(t, t)B(t)u(t)} - \pderiv{t_0}{t}\parens{...}
-\\ & = A(t)\Phi(t, t_0)x_0 + \int_{t_0}^t A(t)\Phi(t,\tau)B(\tau)u(\tau)d\tau + B(t)u(t)
-\\ & = A(\tau)\Phi(t, t_0) x_0 + A(t)\int_{t_0}^t \Phi(t, \tau)B(\tau)
+\\ = A(t)\Phi(t, t_0)x_0 + \int_{t_0}^t A(t)\Phi(t,\tau)B(\tau)u(\tau)d\tau + B(t)u(t)
+\\ = A(\tau)\Phi(t, t_0) x_0 + A(t)\int_{t_0}^t \Phi(t, \tau)B(\tau)
u(\tau) d\tau + B(t) u(t)
-\\ & = A(\tau)\parens{\Phi(t, t_0) x_0 + \int_{t_0}^t \Phi(t, \tau)B(\tau)
+\\ = A(\tau)\parens{\Phi(t, t_0) x_0 + \int_{t_0}^t \Phi(t, \tau)B(\tau)
u(\tau) d\tau} + B(t) u(t)
$$
View
226 fa2012/ee221a/11.md
@@ -0,0 +1,226 @@
+Linear time-Invariant systems
+=============================
+September 27, 2012
+------------------
+Last time, we talked about the time-varying differential equation, and we
+expressed $R(\cdot) = \bracks{A(\cdot), B(\cdot), C(\cdot),
+D(\cdot)}$. Used state transition matrix to show that the solution was
+given by $x(t) = \Phi(t, t_0) x_0 + \int_{t_0}^t B(\tau) u(\tau)
+d\tau$. Integral part is the state transition matrix, and we haven't
+talked about how we would compute this matrix. In general, computing the
+state transition matrix is hard. But there's one important class where
+computing that class becomes much simpler than usual. That is where the
+system does not depend on time.
+
+Linear time-invariant case: $\dot{x} = Ax + Bu, y = Cx + Du, x(t_0) =
+x_0$. Does not matter at what time we start. Typically, WLOG, we use $t_0 =
+0$ (we can't do this in the time-varying case).
+
+Aside: Jacobian linearization
+-----------------------------
+In practice, generally the case that someone
+doesn't present you with a model that looks like this. Usually, you derive
+this (usually nonlinear) model through physics and whatnot. What can I do
+to come up with a linear representation of that system? What is typically
+done is an approximation technique called Jacobian linearization.
+
+So suppose someone gives you a nonlinear system and an output equation,
+and you want to come up with some linear representation of the system.
+
+Two points of view: we could look at the system, and suppose we applied a
+particular input to the system and solve the differential equation
+($u^0(t) \mapsto x^0(t)$, the **nominal input** and **nominal
+solution**). That would result in a solution (**state trajectory**, in
+general). Now suppose that we for some reason want to perturb that input
+($u^0(t) + \delta u(t)$, the **perturbed input**). Suppose in general
+that $\delta u$ is a small perturbation. What this results in is a new
+state trajectory, that we'll define as $x^0(t) + \delta x(t)$, the
+**perturbed solution**.
+
+Now we can derive from that what we call the Jacobian linearization. That
+tells us that if we apply the input, the solution will be $x^0 =
+f(x^0, u^0, t)$, and I also have that $x^0(t_0) = x_0$.
+
+$\dot{x}^0 + \dot{\delta}x = f(x^0 + \delta x, u^0 + \delta u, t)$, where
+$(x^0 + \delta x)(t_0) = x_0 + \delta x_0$. Now I'm going to look at these
+two and perform a Taylor expansion about the nominal input and
+solution. Thus $f(x^0 + \delta x, u^0 + \delta u, t) = f(x^0, u^0, t) +
+\pderiv{}{x} f(x, u, t)\vert_{(x^0, u^0)}\delta x +
+\pderiv{}{u}f(x,u,t)\vert_{(x^0, u^0)} \delta u + \text{higher order
+terms}$ (recall that we also called $\pderiv{}{x}$ $D_1$, i.e. the
+derivative with respect to the first argument).
+
+What I've done is expanded the right hand side of the differential
+equation. Thus $\delta x = \pderiv{}{x} f(x, u, t)\vert_{(x^0, u^0)} \delta
+x + \pderiv{}{u} f(...)\vert_{(x^0, y^0)}\delta u + ...$. If $\delta u,
+\delta x$ small, then we can assume that they are approximately zero, which
+gives us an approximate first-order linear differential equation. This
+gives us a linear time-varying approximation of the dynamics of this
+perturbation vector, in response to a perturbation input. That's what the
+Jacobian linearization gives you: the perturbation away from the nominal
+(we linearized about a bias point).
+
+Consider A(t) to be the Jacobian matrix with respect to x, and B(t) to be
+the Jacobian matrix with respect to u. Remember that this is an
+approximation, and if your system is really nonlinear, and you perturb the
+system a lot (stray too far from the bias point), then this linearization
+may cease to hold.
+
+Linear time-invariant systems
+-----------------------------
+Motivated by the fact that we have a solution to the time-varying equation,
+it depends on the state transition matrix, which right now is an abstract
+thing which we don't have a way of solving. Let's go to a more specific
+class of systems: that where $A, B, C, D$ do not depend on time. We know
+that this system is linear (we don't know yet that it is time-invariant; we
+have to find the response function and show that it satisfies the
+definition of a time-invariant system), so this still requires proof.
+
+Since these don't depend on time, we can use some familiar tools
+(e.g. Laplace transforms) and remember what taking the Laplace transform of
+a derivative is. Denote $\hat{x}(s)$ to be the Laplace transform of
+$x(t)$. The Laplace transform is therefore $s\hat{x}(s) - x_0 = A\hat{x}(s)
++ B\hat{u}(s)$; $s\hat{y}(s) - y_0 = C\hat{x}(s) + D\hat{u}(s)$. The first
+equation becomes $(sI - A)\hat{x}(s) = x_0 + B\hat{u}(s)$, and we'll leave
+the second equation alone.
+
+Let's first consider $\hat{x} = Ax$, $x(0) = x_0$. I could have done the
+same thing, except my right hand side doesn't depend on B: $(sI -
+A)\hat{x}(s) = x_0$. Let's leave that for a second and come back to it, and
+make the following claim: the state transition matrix for $\hat{x} = Ax,
+x(t_0) = x_0$ is $\Phi(t,t_0) = e^{A(t-t_0)}$, which is called the **matrix
+exponential**, defined as $e^{A(t-t_0)} = I + A(t-t_0) + \frac{A^2(t-t_0)^2}{2!}
++ ...$ (Taylor expansion of the exponential function).
+
+We just need to show that the state transition matrix, using definitions we
+had last day, is indeed the state transition matrix for that system. We
+could go back to the definition of the state transition matrix for the
+system, or we could go back to the state transition function for the vector
+differential equation.
+
+From last time, we know that the solution to $\dot{x}A(t)x, x(t_0) = x_0$
+is given by $x(t) = \Phi(t, t_0)x_0$; here, we are claiming then that $x(t)
+= e^{A(t - t_0)} x_0$, where $x(t)$ is the solution to $\dot{x} = Ax$ with
+initial condition $x_0$.
+
+First show that it satisfies the vector differential equation: $\dot{x} =
+\pderiv{}{t}\exp\parens{A(t-t_0)} x_0 = (0 + A + A^2(t - t_0 + ...)x_0 =
+A(I + A(t-t_0) + \frac{A^2}{2}(t-t_0)^2 + ...) x_0 = Ae^{At} x_0 = Ax(t)$,
+so it satisfies the differential equation. Checking the initial condition,
+we get $e^{A \cdot 0}x_0 = I x_0 = x_0$. We've proven that this represents
+the solution to this time-invariant differential equation. By the existence
+and uniqueness theorem, this is the same solution.
+
+Through this proof, we've shown a couple of things: the derivative of the
+matrix exponential, and we evaluated it at $t-t_0=0$. So now let's go back
+and reconsider its infinite series representation and classify some of its
+other properties.
+
+Properties of the matrix exponential
+------------------------------------
+
+* $e^0 = I$
+* $e^{A(t+s)} = e^{At}e^{As}$
+* $e^{(A+B)t} = e^{At}e^{Bt}$ iff $\comm{A}{B} = 0$.
+* $\parens{e^{At}}^{-1} = e^{-At}$, and these properties hold in general if
+ you're looking at $t$ or $t - t_0$.
+* $\deriv{e^{At}}{t} = Ae^{At} = e^{At}A$ (i.e. $\comm{e^At}{A} = 0$)
+* Suppose $X(t) \in \Re^{n \times n}$, $\dot{X} = AX, X(0) = I$, then the
+ solution of this matrix differential equation and initial condition pair
+ is given by $X(t) = e^{At}$. Proof in the notes; very similar to what we
+ just did (more general proof, that the state transition matrix is just
+ given by the matrix exponential).
+
+Calculating $e^{At}$, given $A$
+-------------------------------
+
+What this is now useful for is making more concrete this state transition
+concept. Still a little abstract, since we're still considering the
+exponential of a matrix.
+
+The first point is that using the infinite series representation to compute
+$e^{At}$ is in general hard.
+
+Would be doable if you knew $A$ were nilpotent ($A^k = 0$ for some $k \in
+\mathbb{Z}$), but it's not always feasible. Would not be feasible if $k$
+large.
+
+The way one usually computes the state transition matrix $e^{At}$ is as
+follows:
+
+Recall: $\dot{X}(t) = AX(t)$, with $X(0) = I$. We know from what we've done
+before (property 6) that we can easily prove $X(t) = e^{At}$. We also know
+that $(sI - A)\hat{X}(s) = I$, so $\hat{X}(s) = (sI - A)^{-1}$. That tells
+me that $e^{At} = \mathcal{L}^{-1}\parens{(sI - A)^{-1}}$. That gives us a
+way of computing $e^{At}$, assuming we have a way to compute a matrix's
+inverse and an inverse Laplace transform. This is what people usually do,
+and most algorithms approach the problem this way. Generally hard to
+compute the inverse and the inverse Laplace transform.
+
+Requires proof regarding why $sI - A$ always has an inverse given by
+$e^{-At}$.
+
+Clive Moller started LINPACK (Linear algebra package; engine behind
+MATLAB). Famous in computational linear algebra. Paper: 19 dubious ways to
+compute the matrix exponential. Actually a hard problem in
+general. Factoring of $n$-degree polynomials.
+
+If we were to consider our simple nilpotent case, we'll compute $sI - A =
+\begin{bmatrix}s & -1 \\ 0 & s\end{bmatrix}$. We can immediately write down
+its inverse as $\begin{bmatrix}\frac{1}{s} & \frac{1}{s^2} \\ 0 &
+\frac{1}{s}\end{bmatrix}$. Inverse Laplace transform takes no work; it's
+simply $\begin{bmatrix}1 & t \\ 0 & 1\end{bmatrix}$.
+
+In the next lecture (and next series of lectures) we will be talking about
+the Jordan form of a matrix. We have a way to compute $e^{At}$. We'll write
+$A = TJT^{-1}$. In its simplest case, it's diagonal. Either way, all of the
+work is in exponentiating $J$. You still end up doing something that's the
+inverse Laplace transform of $sI - J$.
+
+We've shown that for a linear TI system, $\dot{x} = Ax + Bu$; $y = Cx + Du$
+($x(0) = x_0$). $x(t) = e^{At}x_0 + \int_0^t e^{A(t-\tau)} Bu(\tau)
+d\tau$. We proved it last time, but you can check this satisfies the
+differential equation and initial condition.
+
+From that, you can compute the response function and show that it's
+time-invariant. Let's conclude today's class with a planar inverted
+pendulum. Let's call the angle of rotation away from the vertical $\theta$,
+mass $m$, length $\ell$, and torque $\tau$. Equations of motion: $m\ell^2
+\ddot{\theta} - mg\ell \sin \theta = \tau$. Perform Jacobian
+linearization; we'll define $\theta = 0$ at $\pi/2$, and we're linearizing
+about the trivial trajectory that the pendulum is straight up. Therefore
+$\delta \theta = \theta \implies m\ell^2 \ddot{\theta} + mg\ell\theta
+= \tau$, where $u = \frac{\tau}{m\ell^2}$, and $\Omega^2 = \frac{g}{\ell}$,
+$\dot{x}_1 = x_2$, and $\dot{x}_2 = \Omega^2 x_1 + u$.
+
+$y = \theta - x_1, \dot{x}_1 = x_2, \dot{x}_2 = \Omega^2 x_1 + u, y =
+x_1$. Stabilization of system via feedback by considering poles of Laplace
+transform, etc. $\frac{\hat{y}}{\hat{u}} = \frac{1}{s^2 - \Omega^2} =
+G(s)$ (the plant).
+
+In general, not a good idea: canceling unstable pole, and then using
+feedback. In the notes, this is some controller $K(s)$. If we look at the
+open-loop transfer function ($K(s)G(s) = \frac{1}{s(s+\Omega)}$), $u =
+\frac{s-\Omega}{s}\bar{u}$, so $\dot{u} = \dot{\bar{u}} - \Omega\bar{u}$
+(assume zero initial conditions on $u, \bar{u}$). If we define a third
+state variable now, $x_3 = u - \bar{u}$, then that tells us that $\dot{x}_3
+= \Omega \bar{u}$. Here, I have $A = \begin{bmatrix} 0 & 1 & 0 \\ \Omega^2
+& 0 & -1 \\ 0 & 0 & 0 \end{bmatrix}$, $B = \begin{bmatrix}0 \\ 1 \\
+\Omega\end{bmatrix}$, $C = \begin{bmatrix}1 & 0 & 0\end{bmatrix}$, $D =
+0$. Out of time today, but we'll solve at the beginning of Tuesday's class.
+
+Solve for $x(t) = \begin{bmatrix}x_1, x_2, x_3\end{bmatrix}$. We have a few
+approaches:
+
+* Using $A,B,C,D$: compute the following: $y(t) = Ce^{At} x_0 + C\int_0^t
+ e^{A(t - \tau)}Bu(\tau) d\tau$. In doing that, we'll need to compute
+ $e^{At}$, and then we have this expression for general $u$: suppose you
+ supply a step input.
+* Suppose $\bar{u} = -y = -Cx$. Therefore $\dot{x} = Ax + B(-Cx) = (A -
+ BC)x$. We have a new $A_{CL} = A - BC$, and we can exponentiate this
+ instead.
+
+Foreshadows later, when we think about control. Introduces this standard
+notion of feedback for stabilizing systems. Using newfound knowledge of
+state transition matrix for TI systems (how to compute it), see how to
+compute. See what MATLAB is doing.
View
4 fa2012/ee221a/2.md
@@ -1,5 +1,5 @@
-EE 221A: Linear System Theory
-=============================
+Functions and Vector Spaces
+===========================
August 28, 2012
---------------
View
4 fa2012/ee221a/3.md
@@ -1,5 +1,5 @@
-EE 221A: Linear System Theory
-=============================
+Vector Spaces and Linearity
+===========================
August 30, 2012
---------------
View
4 fa2012/ee221a/4.md
@@ -1,5 +1,5 @@
-EE 221A: Linear System Theory
-=============================
+Matrix Representation of Linear Maps
+====================================
September 4, 2012
-----------------
Today
View
4 fa2012/ee221a/5.md
@@ -1,5 +1,5 @@
-EE 221A: Linear System Theory
-=============================
+Guest Lecture: Induced Norms and Inner Products
+===============================================
September 6, 2012
-----------------
Induced norms of matrices
View
4 fa2012/ee221a/6.md
@@ -1,5 +1,5 @@
-EE 221A: Linear System Theory
-=============================
+Singular Value Decomposition & Introduction to Differential Equations
+=====================================================================
September 11, 2012
-----------------
View
4 fa2012/ee221a/7.md
@@ -1,5 +1,5 @@
-EE 221A: Linear System Theory
-=============================
+Existence and Uniqueness of Solutions to Differential Equations
+===============================================================
September 13, 2012
------------------
View
4 fa2012/ee221a/8.md
@@ -1,5 +1,5 @@
-EE 221A: Linear System Theory
-=============================
+Proof of Existence and Uniqueness Theorem
+=========================================
September 18, 2012
------------------
View
26 fa2012/ee221a/9.md
@@ -1,13 +1,13 @@
-EE 221A: Linear System Theory
-=============================
+Introduction to dynamical systems
+=================================
September 20, 2012
------------------
-Introduction to dynamical systems. Suppose we have equations $\dot{x} =
-f(x, u, t)$, $\fn{f}{\Re^n \times \Re^n \times \Re_+}{\Re^n}$ and $y = h(x,
-u, t)$, $\fn{h}{\Re^n \times \Re^n \times \Re_+}{\Re^n}$. We define $n_i$ as
-the dimension of the input space, $n_o$ as dimension of the output space,
-and $n$ as the dimension of the state space.
+Suppose we have equations $\dot{x} = f(x, u, t)$, $\fn{f}{\Re^n \times
+\Re^n \times \Re_+}{\Re^n}$ and $y = h(x, u, t)$, $\fn{h}{\Re^n \times
+\Re^n \times \Re_+}{\Re^n}$. We define $n_i$ as the dimension of the input
+space, $n_o$ as dimension of the output space, and $n$ as the dimension of
+the state space.
We've looked at the form, and if we specify a particular $\bar{u}(t)$ over some
time interval of interest, then we can plug this into the right hand side
@@ -31,7 +31,7 @@ Notions of discretizing.
What is a dynamical system?
---------------------------
-As discussed in first lecture, we consider time $\Tau$ to be a privileged
+As discussed in first lecture, we consider time $\tau$ to be a privileged
variable. Based on our definition of time, the inputs and outputs are all
functions of time.
@@ -40,28 +40,28 @@ Now we're going to define a **dynamical system** as a 5-tuple: $(\mathcal{U},
transition function, output map).
We define the **input space** as the set of input functions over time to an
-input set $U$ (i.e. $\mathcal{U} = \{\fn{u}{\Tau}{U}\}$. Typically, $U =
+input set $U$ (i.e. $\mathcal{U} = \{\fn{u}{\tau}{U}\}$. Typically, $U =
\Re^{n_i}$).
We also define the **output space** as the set of output functions over time to
-an output set $Y$ (i.e. $\mathcal{Y} = \{\fn{y}{\Tau}{Y}\}$). Typically, $Y
+an output set $Y$ (i.e. $\mathcal{Y} = \{\fn{y}{\tau}{Y}\}$). Typically, $Y
= \Re^{n_o}$.
$\Sigma$ is our **state space**. Not defined as the function, but the actual
state space. Typically, $\Sigma = \Re^n$, and we can go back and think
-about the function $x(t) \in \Sigma$. $\fn{x}{\Tau}{\Sigma}$ is called the
+about the function $x(t) \in \Sigma$. $\fn{x}{\tau}{\Sigma}$ is called the
state trajectory.
$s$ is called the **state transition function** because it defines how the
state changes in response to time and the initial state and the
-input. $\fn{s}{\Tau \times \Tau \times \Sigma \times U }{\Sigma}$. Usually
+input. $\fn{s}{\tau \times \tau \times \Sigma \times U }{\Sigma}$. Usually
we write this as $x(t_1) = s(t_1, t_0, x_0, u)$, where $u$ is the function
$u(\cdot) |_{t_0}^{t_1}$. This is important: coming towards how we define
state. Only things you need to get to state at the new time are the initial
state, inputs, and dynamics.
Finally, we have this **output map** (sometimes called the readout map)
-$r$. $\fn{r}{\Tau \times \Sigma \times U}{Y}$. That is, we can think about
+$r$. $\fn{r}{\tau \times \Sigma \times U}{Y}$. That is, we can think about
$y(t) = r(t, x(t), u(t))$. There's something fundamentally different
between $r$ and $s$. $s$ depended on the function $u$, whereas $r$ only
depended on the current value of $u$ at a particular time.
View
319 fa2012/ee221a/ee221a.md
@@ -4,16 +4,14 @@ EE 221A: Linear System Theory
=============================
August 23, 2012
---------------
+Administrivia
+-------------
+Prof. Claire Tomlin (tomlin@eecs). 721 Sutardja Dai Hall. Somewhat
+tentative office hours on schedule: T 1-2, W 11-12.
+http://inst.eecs.berkeley.edu/~ee221a
-Prof. Claire Tomlin (tomlin@eecs)
-721 Sutardja Dai Hall
-inst.eecs.berkeley.edu/~ee221a
-
-GSI: Insoon Yang (iyang@eecs)
-
-Somewhat tentative office hours on schedule: T 1-2, W 11-12.
-
-In Soon's office hours: M 1:30 - 2:30, θ 11-12.
+GSI: Insoon Yang (iyang@eecs). In Soon's office hours: M 1:30 - 2:30, θ
+11-12.
Homeworks typically due on Thursday or Friday.
@@ -156,7 +154,7 @@ for a certain set of parameters. Very different, but they complement each
other. Analyze simpler models, simulate more complex models.
Linear Algebra
-==============
+--------------
Functions and their properties.
Fields, vector spaces, properties and subspaces.
@@ -172,8 +170,8 @@ n-tuples)
<a name='2'></a>
-EE 221A: Linear System Theory
-=============================
+Functions and Vector Spaces
+===========================
August 28, 2012
---------------
@@ -297,8 +295,8 @@ and representation as multiplication by matrices.
<a name='3'></a>
-EE 221A: Linear System Theory
-=============================
+Vector Spaces and Linearity
+===========================
August 30, 2012
---------------
@@ -406,8 +404,8 @@ $$\mathcal{A}(x_0) = \mathcal{A}(x_1) \iff x - x_0 \in N(\mathcal{A})$$
<a name='4'></a>
-EE 221A: Linear System Theory
-=============================
+Matrix Representation of Linear Maps
+====================================
September 4, 2012
-----------------
Today
@@ -565,8 +563,8 @@ $\forall y \in S, x : x \ge y$).
<a name='5'></a>
-EE 221A: Linear System Theory
-=============================
+Guest Lecture: Induced Norms and Inner Products
+===============================================
September 6, 2012
-----------------
Induced norms of matrices
@@ -804,8 +802,8 @@ Basically, you get after all this computation that $b_2 = \frac{1}{12} t -
<a name='6'></a>
-EE 221A: Linear System Theory
-=============================
+Singular Value Decomposition & Introduction to Differential Equations
+=====================================================================
September 11, 2012
-----------------
@@ -961,8 +959,8 @@ Next time we'll talk about Lipschitz continuity.
<a name='7'></a>
-EE 221A: Linear System Theory
-=============================
+Existence and Uniqueness of Solutions to Differential Equations
+===============================================================
September 13, 2012
------------------
@@ -1140,8 +1138,8 @@ you choose.
<a name='8'></a>
-EE 221A: Linear System Theory
-=============================
+Proof of Existence and Uniqueness Theorem
+=========================================
September 18, 2012
------------------
@@ -1354,16 +1352,16 @@ time-invariant systems.
<a name='9'></a>
-EE 221A: Linear System Theory
-=============================
+Introduction to dynamical systems
+=================================
September 20, 2012
------------------
-Introduction to dynamical systems. Suppose we have equations $\dot{x} =
-f(x, u, t)$, $\fn{f}{\Re^n \times \Re^n \times \Re_+}{\Re^n}$ and $y = h(x,
-u, t)$, $\fn{h}{\Re^n \times \Re^n \times \Re_+}{\Re^n}$. We define $n_i$ as
-the dimension of the input space, $n_o$ as dimension of the output space,
-and $n$ as the dimension of the state space.
+Suppose we have equations $\dot{x} = f(x, u, t)$, $\fn{f}{\Re^n \times
+\Re^n \times \Re_+}{\Re^n}$ and $y = h(x, u, t)$, $\fn{h}{\Re^n \times
+\Re^n \times \Re_+}{\Re^n}$. We define $n_i$ as the dimension of the input
+space, $n_o$ as dimension of the output space, and $n$ as the dimension of
+the state space.
We've looked at the form, and if we specify a particular $\bar{u}(t)$ over some
time interval of interest, then we can plug this into the right hand side
@@ -1387,7 +1385,7 @@ Notions of discretizing.
What is a dynamical system?
---------------------------
-As discussed in first lecture, we consider time $\Tau$ to be a privileged
+As discussed in first lecture, we consider time $\tau$ to be a privileged
variable. Based on our definition of time, the inputs and outputs are all
functions of time.
@@ -1396,28 +1394,28 @@ Now we're going to define a **dynamical system** as a 5-tuple: $(\mathcal{U},
transition function, output map).
We define the **input space** as the set of input functions over time to an
-input set $U$ (i.e. $\mathcal{U} = \{\fn{u}{\Tau}{U}\}$. Typically, $U =
+input set $U$ (i.e. $\mathcal{U} = \{\fn{u}{\tau}{U}\}$. Typically, $U =
\Re^{n_i}$).
We also define the **output space** as the set of output functions over time to
-an output set $Y$ (i.e. $\mathcal{Y} = \{\fn{y}{\Tau}{Y}\}$). Typically, $Y
+an output set $Y$ (i.e. $\mathcal{Y} = \{\fn{y}{\tau}{Y}\}$). Typically, $Y
= \Re^{n_o}$.
$\Sigma$ is our **state space**. Not defined as the function, but the actual
state space. Typically, $\Sigma = \Re^n$, and we can go back and think
-about the function $x(t) \in \Sigma$. $\fn{x}{\Tau}{\Sigma}$ is called the
+about the function $x(t) \in \Sigma$. $\fn{x}{\tau}{\Sigma}$ is called the
state trajectory.
$s$ is called the **state transition function** because it defines how the
state changes in response to time and the initial state and the
-input. $\fn{s}{\Tau \times \Tau \times \Sigma \times U }{\Sigma}$. Usually
+input. $\fn{s}{\tau \times \tau \times \Sigma \times U }{\Sigma}$. Usually
we write this as $x(t_1) = s(t_1, t_0, x_0, u)$, where $u$ is the function
$u(\cdot) |_{t_0}^{t_1}$. This is important: coming towards how we define
state. Only things you need to get to state at the new time are the initial
state, inputs, and dynamics.
Finally, we have this **output map** (sometimes called the readout map)
-$r$. $\fn{r}{\Tau \times \Sigma \times U}{Y}$. That is, we can think about
+$r$. $\fn{r}{\tau \times \Sigma \times U}{Y}$. That is, we can think about
$y(t) = r(t, x(t), u(t))$. There's something fundamentally different
between $r$ and $s$. $s$ depended on the function $u$, whereas $r$ only
depended on the current value of $u$ at a particular time.
@@ -1508,12 +1506,10 @@ $\forall x$ and some $\tilde{x}$, the two systems are equivalent.
<a name='10'></a>
-EE 221A: Linear System Theory
-=============================
+Linear time-varying systems
+===========================
September 25, 2012
------------------
-Linear time-varying systems
----------------------------
Recall the state transition function is given some function of the current
time with initial state, initial time, and inputs, Suppose you have a
differential equation; how do you acquire the state transition function?
@@ -1604,17 +1600,17 @@ we can use the same machinery. If someone gives you a candidate solution,
you can easily show that it is the solution.
Recall the Leibniz rule, which we'll state in general as follows:
-$\pderiv{}{z} \int_{a(z)}^{b^z} f(x, z) dx = \int_{a(z)}^{b^z}
-\pderiv{}{x}f(x, z) dx + \pderiv{b}{z} f(b, z) - \pderiv{a}{z} f(a, z}$.
+$\pderiv{}{z} \int_{a(z)}^{b(z)} f(x, z) dx = \int_{a(z)}^{b(z)}
+\pderiv{}{x}f(x, z) dx + \pderiv{b}{z} f(b, z) - \pderiv{a}{z} f(a, z)$.
$$
-\dot{x}(t) & = A(t) \Phi(t, t_0) x_0 + \int_{t_0}^t
+\dot{x}(t) = A(t) \Phi(t, t_0) x_0 + \int_{t_0}^t
\pderiv{}{t} \parens{\Phi(t, \tau)B(\tau)u(\tau)} d\tau +
\pderiv{t}{t}\parens{\Phi(t, t)B(t)u(t)} - \pderiv{t_0}{t}\parens{...}
-\\ & = A(t)\Phi(t, t_0)x_0 + \int_{t_0}^t A(t)\Phi(t,\tau)B(\tau)u(\tau)d\tau + B(t)u(t)
-\\ & = A(\tau)\Phi(t, t_0) x_0 + A(t)\int_{t_0}^t \Phi(t, \tau)B(\tau)
+\\ = A(t)\Phi(t, t_0)x_0 + \int_{t_0}^t A(t)\Phi(t,\tau)B(\tau)u(\tau)d\tau + B(t)u(t)
+\\ = A(\tau)\Phi(t, t_0) x_0 + A(t)\int_{t_0}^t \Phi(t, \tau)B(\tau)
u(\tau) d\tau + B(t) u(t)
-\\ & = A(\tau)\parens{\Phi(t, t_0) x_0 + \int_{t_0}^t \Phi(t, \tau)B(\tau)
+\\ = A(\tau)\parens{\Phi(t, t_0) x_0 + \int_{t_0}^t \Phi(t, \tau)B(\tau)
u(\tau) d\tau} + B(t) u(t)
$$
@@ -1632,3 +1628,232 @@ time-invariance or time variance through the response map. But is it
linear? You have the state transition function, so we can compute the
response function (recall: readout map composed with the state transition
function) and ask if this is a linear map.
+
+<a name='11'></a>
+
+Linear time-Invariant systems
+=============================
+September 27, 2012
+------------------
+Last time, we talked about the time-varying differential equation, and we
+expressed $R(\cdot) = \bracks{A(\cdot), B(\cdot), C(\cdot),
+D(\cdot)}$. Used state transition matrix to show that the solution was
+given by $x(t) = \Phi(t, t_0) x_0 + \int_{t_0}^t B(\tau) u(\tau)
+d\tau$. Integral part is the state transition matrix, and we haven't
+talked about how we would compute this matrix. In general, computing the
+state transition matrix is hard. But there's one important class where
+computing that class becomes much simpler than usual. That is where the
+system does not depend on time.
+
+Linear time-invariant case: $\dot{x} = Ax + Bu, y = Cx + Du, x(t_0) =
+x_0$. Does not matter at what time we start. Typically, WLOG, we use $t_0 =
+0$ (we can't do this in the time-varying case).
+
+Aside: Jacobian linearization
+-----------------------------
+In practice, generally the case that someone
+doesn't present you with a model that looks like this. Usually, you derive
+this (usually nonlinear) model through physics and whatnot. What can I do
+to come up with a linear representation of that system? What is typically
+done is an approximation technique called Jacobian linearization.
+
+So suppose someone gives you a nonlinear system and an output equation,
+and you want to come up with some linear representation of the system.
+
+Two points of view: we could look at the system, and suppose we applied a
+particular input to the system and solve the differential equation
+($u^0(t) \mapsto x^0(t)$, the **nominal input** and **nominal
+solution**). That would result in a solution (**state trajectory**, in
+general). Now suppose that we for some reason want to perturb that input
+($u^0(t) + \delta u(t)$, the **perturbed input**). Suppose in general
+that $\delta u$ is a small perturbation. What this results in is a new
+state trajectory, that we'll define as $x^0(t) + \delta x(t)$, the
+**perturbed solution**.
+
+Now we can derive from that what we call the Jacobian linearization. That
+tells us that if we apply the input, the solution will be $x^0 =
+f(x^0, u^0, t)$, and I also have that $x^0(t_0) = x_0$.
+
+$\dot{x}^0 + \dot{\delta}x = f(x^0 + \delta x, u^0 + \delta u, t)$, where
+$(x^0 + \delta x)(t_0) = x_0 + \delta x_0$. Now I'm going to look at these
+two and perform a Taylor expansion about the nominal input and
+solution. Thus $f(x^0 + \delta x, u^0 + \delta u, t) = f(x^0, u^0, t) +
+\pderiv{}{x} f(x, u, t)\vert_{(x^0, u^0)}\delta x +
+\pderiv{}{u}f(x,u,t)\vert_{(x^0, u^0)} \delta u + \text{higher order
+terms}$ (recall that we also called $\pderiv{}{x}$ $D_1$, i.e. the
+derivative with respect to the first argument).
+
+What I've done is expanded the right hand side of the differential
+equation. Thus $\delta x = \pderiv{}{x} f(x, u, t)\vert_{(x^0, u^0)} \delta
+x + \pderiv{}{u} f(...)\vert_{(x^0, y^0)}\delta u + ...$. If $\delta u,
+\delta x$ small, then we can assume that they are approximately zero, which
+gives us an approximate first-order linear differential equation. This
+gives us a linear time-varying approximation of the dynamics of this
+perturbation vector, in response to a perturbation input. That's what the
+Jacobian linearization gives you: the perturbation away from the nominal
+(we linearized about a bias point).
+
+Consider A(t) to be the Jacobian matrix with respect to x, and B(t) to be
+the Jacobian matrix with respect to u. Remember that this is an
+approximation, and if your system is really nonlinear, and you perturb the
+system a lot (stray too far from the bias point), then this linearization
+may cease to hold.
+
+Linear time-invariant systems
+-----------------------------
+Motivated by the fact that we have a solution to the time-varying equation,
+it depends on the state transition matrix, which right now is an abstract
+thing which we don't have a way of solving. Let's go to a more specific
+class of systems: that where $A, B, C, D$ do not depend on time. We know
+that this system is linear (we don't know yet that it is time-invariant; we
+have to find the response function and show that it satisfies the
+definition of a time-invariant system), so this still requires proof.
+
+Since these don't depend on time, we can use some familiar tools
+(e.g. Laplace transforms) and remember what taking the Laplace transform of
+a derivative is. Denote $\hat{x}(s)$ to be the Laplace transform of
+$x(t)$. The Laplace transform is therefore $s\hat{x}(s) - x_0 = A\hat{x}(s)
++ B\hat{u}(s)$; $s\hat{y}(s) - y_0 = C\hat{x}(s) + D\hat{u}(s)$. The first
+equation becomes $(sI - A)\hat{x}(s) = x_0 + B\hat{u}(s)$, and we'll leave
+the second equation alone.
+
+Let's first consider $\hat{x} = Ax$, $x(0) = x_0$. I could have done the
+same thing, except my right hand side doesn't depend on B: $(sI -
+A)\hat{x}(s) = x_0$. Let's leave that for a second and come back to it, and
+make the following claim: the state transition matrix for $\hat{x} = Ax,
+x(t_0) = x_0$ is $\Phi(t,t_0) = e^{A(t-t_0)}$, which is called the **matrix
+exponential**, defined as $e^{A(t-t_0)} = I + A(t-t_0) + \frac{A^2(t-t_0)^2}{2!}
++ ...$ (Taylor expansion of the exponential function).
+
+We just need to show that the state transition matrix, using definitions we
+had last day, is indeed the state transition matrix for that system. We
+could go back to the definition of the state transition matrix for the
+system, or we could go back to the state transition function for the vector
+differential equation.
+
+From last time, we know that the solution to $\dot{x}A(t)x, x(t_0) = x_0$
+is given by $x(t) = \Phi(t, t_0)x_0$; here, we are claiming then that $x(t)
+= e^{A(t - t_0)} x_0$, where $x(t)$ is the solution to $\dot{x} = Ax$ with
+initial condition $x_0$.
+
+First show that it satisfies the vector differential equation: $\dot{x} =
+\pderiv{}{t}\exp\parens{A(t-t_0)} x_0 = (0 + A + A^2(t - t_0 + ...)x_0 =
+A(I + A(t-t_0) + \frac{A^2}{2}(t-t_0)^2 + ...) x_0 = Ae^{At} x_0 = Ax(t)$,
+so it satisfies the differential equation. Checking the initial condition,
+we get $e^{A \cdot 0}x_0 = I x_0 = x_0$. We've proven that this represents
+the solution to this time-invariant differential equation. By the existence
+and uniqueness theorem, this is the same solution.
+
+Through this proof, we've shown a couple of things: the derivative of the
+matrix exponential, and we evaluated it at $t-t_0=0$. So now let's go back
+and reconsider its infinite series representation and classify some of its
+other properties.
+
+Properties of the matrix exponential
+------------------------------------
+
+* $e^0 = I$
+* $e^{A(t+s)} = e^{At}e^{As}$
+* $e^{(A+B)t} = e^{At}e^{Bt}$ iff $\comm{A}{B} = 0$.
+* $\parens{e^{At}}^{-1} = e^{-At}$, and these properties hold in general if
+ you're looking at $t$ or $t - t_0$.
+* $\deriv{e^{At}}{t} = Ae^{At} = e^{At}A$ (i.e. $\comm{e^At}{A} = 0$)
+* Suppose $X(t) \in \Re^{n \times n}$, $\dot{X} = AX, X(0) = I$, then the
+ solution of this matrix differential equation and initial condition pair
+ is given by $X(t) = e^{At}$. Proof in the notes; very similar to what we
+ just did (more general proof, that the state transition matrix is just
+ given by the matrix exponential).
+
+Calculating $e^{At}$, given $A$
+-------------------------------
+
+What this is now useful for is making more concrete this state transition
+concept. Still a little abstract, since we're still considering the
+exponential of a matrix.
+
+The first point is that using the infinite series representation to compute
+$e^{At}$ is in general hard.
+
+Would be doable if you knew $A$ were nilpotent ($A^k = 0$ for some $k \in
+\mathbb{Z}$), but it's not always feasible. Would not be feasible if $k$
+large.
+
+The way one usually computes the state transition matrix $e^{At}$ is as
+follows:
+
+Recall: $\dot{X}(t) = AX(t)$, with $X(0) = I$. We know from what we've done
+before (property 6) that we can easily prove $X(t) = e^{At}$. We also know
+that $(sI - A)\hat{X}(s) = I$, so $\hat{X}(s) = (sI - A)^{-1}$. That tells
+me that $e^{At} = \mathcal{L}^{-1}\parens{(sI - A)^{-1}}$. That gives us a
+way of computing $e^{At}$, assuming we have a way to compute a matrix's
+inverse and an inverse Laplace transform. This is what people usually do,
+and most algorithms approach the problem this way. Generally hard to
+compute the inverse and the inverse Laplace transform.
+
+Requires proof regarding why $sI - A$ always has an inverse given by
+$e^{-At}$.
+
+Clive Moller started LINPACK (Linear algebra package; engine behind
+MATLAB). Famous in computational linear algebra. Paper: 19 dubious ways to
+compute the matrix exponential. Actually a hard problem in
+general. Factoring of $n$-degree polynomials.
+
+If we were to consider our simple nilpotent case, we'll compute $sI - A =
+\begin{bmatrix}s & -1 \\ 0 & s\end{bmatrix}$. We can immediately write down
+its inverse as $\begin{bmatrix}\frac{1}{s} & \frac{1}{s^2} \\ 0 &
+\frac{1}{s}\end{bmatrix}$. Inverse Laplace transform takes no work; it's
+simply $\begin{bmatrix}1 & t \\ 0 & 1\end{bmatrix}$.
+
+In the next lecture (and next series of lectures) we will be talking about
+the Jordan form of a matrix. We have a way to compute $e^{At}$. We'll write
+$A = TJT^{-1}$. In its simplest case, it's diagonal. Either way, all of the
+work is in exponentiating $J$. You still end up doing something that's the
+inverse Laplace transform of $sI - J$.
+
+We've shown that for a linear TI system, $\dot{x} = Ax + Bu$; $y = Cx + Du$
+($x(0) = x_0$). $x(t) = e^{At}x_0 + \int_0^t e^{A(t-\tau)} Bu(\tau)
+d\tau$. We proved it last time, but you can check this satisfies the
+differential equation and initial condition.
+
+From that, you can compute the response function and show that it's
+time-invariant. Let's conclude today's class with a planar inverted
+pendulum. Let's call the angle of rotation away from the vertical $\theta$,
+mass $m$, length $\ell$, and torque $\tau$. Equations of motion: $m\ell^2
+\ddot{\theta} - mg\ell \sin \theta = \tau$. Perform Jacobian
+linearization; we'll define $\theta = 0$ at $\pi/2$, and we're linearizing
+about the trivial trajectory that the pendulum is straight up. Therefore
+$\delta \theta = \theta \implies m\ell^2 \ddot{\theta} + mg\ell\theta
+= \tau$, where $u = \frac{\tau}{m\ell^2}$, and $\Omega^2 = \frac{g}{\ell}$,
+$\dot{x}_1 = x_2$, and $\dot{x}_2 = \Omega^2 x_1 + u$.
+
+$y = \theta - x_1, \dot{x}_1 = x_2, \dot{x}_2 = \Omega^2 x_1 + u, y =
+x_1$. Stabilization of system via feedback by considering poles of Laplace
+transform, etc. $\frac{\hat{y}}{\hat{u}} = \frac{1}{s^2 - \Omega^2} =
+G(s)$ (the plant).
+
+In general, not a good idea: canceling unstable pole, and then using
+feedback. In the notes, this is some controller $K(s)$. If we look at the
+open-loop transfer function ($K(s)G(s) = \frac{1}{s(s+\Omega)}$), $u =
+\frac{s-\Omega}{s}\bar{u}$, so $\dot{u} = \dot{\bar{u}} - \Omega\bar{u}$
+(assume zero initial conditions on $u, \bar{u}$). If we define a third
+state variable now, $x_3 = u - \bar{u}$, then that tells us that $\dot{x}_3
+= \Omega \bar{u}$. Here, I have $A = \begin{bmatrix} 0 & 1 & 0 \\ \Omega^2
+& 0 & -1 \\ 0 & 0 & 0 \end{bmatrix}$, $B = \begin{bmatrix}0 \\ 1 \\
+\Omega\end{bmatrix}$, $C = \begin{bmatrix}1 & 0 & 0\end{bmatrix}$, $D =
+0$. Out of time today, but we'll solve at the beginning of Tuesday's class.
+
+Solve for $x(t) = \begin{bmatrix}x_1, x_2, x_3\end{bmatrix}$. We have a few
+approaches:
+
+* Using $A,B,C,D$: compute the following: $y(t) = Ce^{At} x_0 + C\int_0^t
+ e^{A(t - \tau)}Bu(\tau) d\tau$. In doing that, we'll need to compute
+ $e^{At}$, and then we have this expression for general $u$: suppose you
+ supply a step input.
+* Suppose $\bar{u} = -y = -Cx$. Therefore $\dot{x} = Ax + B(-Cx) = (A -
+ BC)x$. We have a new $A_{CL} = A - BC$, and we can exponentiate this
+ instead.
+
+Foreshadows later, when we think about control. Introduces this standard
+notion of feedback for stabilizing systems. Using newfound knowledge of
+state transition matrix for TI systems (how to compute it), see how to
+compute. See what MATLAB is doing.

0 comments on commit 0cc157f

Please sign in to comment.
Something went wrong with that request. Please try again.