EE263 Midterm Solution

March 23, 2018 | Author: luisfletscher6764 | Category: Nonlinear System, Euclidean Vector, Partial Differential Equation, Linear Algebra, Mathematical Concepts


Comments



Description

EE263 Midterm Exam SolutionsThis is a 24 hour take-home midterm. Please turn it in at Bytes Cafe in the Packard building, 24 hours after you pick it up. • You may use any books, notes, or computer programs (e.g., matlab), but you may not discuss the exam with others until Oct. 26, after everyone has taken the exam. The only exception is that you can ask the TAs or Professor Lall for clarification, by emailing to the staff email address [email protected]. We’ve tried pretty hard to make the exam unambiguous and clear, so we’re unlikely to say much. • Since you have 24 hours, we expect your solutions to be legible, neat, and clear. Do not hand in your rough notes, and please try to simplify your solutions as much as you can. We will deduct points from solutions that are technically correct, but much more complicated than they need to be. • Please check your email a few times during the exam, just in case we need to send out a clarification or other announcement. It’s unlikely we’ll need to do this, but you never know. • Attach the official exam cover page (available when you pick up or drop off the exam, or from the midterm info page) to your exam, and assemble your solutions to the problems in order, i.e., problem 1, problem 2, . . . , problem 6. Start each solution on a new page. • Please make a copy of your exam before handing it in. We have never lost one, but it might occur. • When a problem involves some computation (say, using matlab), we do not want just the final answers. We want a clear discussion and justification of exactly what you did, the matlab source code that produces the result, and the final numerical result. Be sure to show us your verification that your computed solution satisfies whatever properties it is supposed to, at least up to numerical precision. For example, if you compute a vector x that is supposed to satisfy Ax = b (say), show us the matlab code that checks this, and the result. (This might be done by the matlab code norm(A*x-b); be sure to show us the result, which should be very small.) We will not check your numerical solutions for you, in cases where there is more than one solution. • In the portion of your solutions where you explain the mathematical approach, you cannot refer to matlab operators, such as the backslash operator. (You can, of course, refer to inverses of matrices, or any other standard mathematical construct.) • Some of the problems are described in a practical setting, such as energy consumption, population dynamics, or wireless communications. You do not need to understand 1 anything about the application area to solve these problems. We’ve taken special care to make sure all the information and math needed to solve the problem is given in the problem description. • Some of the problems require you to download and run a matlab file to generate the data needed. These files can be found at the URL http://www.stanford.edu/class/ee263/mterm14_mfiles/FILENAME where you should substitute the particular filename (given in the problem) for FILENAME. There are no links on the course web page pointing to these files, so you’ll have to type in the whole URL yourself. 2 (e) x ∈ N (AT ) ⇐⇒ x ∈ / R(A). R(A) ⊆ R(B) ⇔ p = dim (R(A)) ≤ dim (R(B)) . + qn qnT w = wT Iw = wT w = kwk. + qr qrT w r X 2 = w T qi ≤ i=1 n X i=1 T =w w T qi 2  q1 q1T + . Then kQT wk2 = wT QQT w  = wT q1 q1T + . For each part. (g) A is not full rank ⇒ there is an x 6= 0.1. . . we have q ≥ p. (a) If Q has orthonormal columns then kQT wk ≤ kwk for all w. N (A) = {0} ⇔ dim (R(A)) = p. If N (A) = {0} and R(A) ⊆ R(B) then p ≤ q.   (c) If V = V1 V2 is invertible and R(V1 ) = N (A). then AB is not full rank if and only if B is not full rank. True or false. we will grade any question as incorrect if it contains any explanation. . If N (A) = {0} and R(A) ⊆ R(B) then p ≤ q. specify whether the statement is true or false. 3 . (b) Suppose A ∈ Rm×p and B ∈ Rm×q . and since q ≥ rank(B) = dim (R(B)) . then N (AV2 ) = {0}. (b) Suppose A ∈ Rm×p and B ∈ Rm×q . . . True. Do not give any explanation. qr ]. suppose qi ∈ Rn . we can construct a orthonormal basis of Rn by adding n − r orthonormal columns to Q. or counterexamples. True. proofs. such that Ax = 0. (a) If Q has orthonormal columns then kQT wk ≤ kwk for all w. . Solution. (f) If A is invertible. Q = [q1 . (d) rank([A B]) = rank(A) = rank(B) =⇒ R(A) = R(B). . . x= . AB = C is not full rank. then V2 x = 0. rank([A B]) = rank(A) =⇒ R(B) ⊆ R(A). and by definition V2 x ∈ R(V2 ) so V2 x ∈ R(V1 ) ∩ R(V2 ). rank([A B]) = rank(B) =⇒ R(A) ⊆ R(B). so x = 0. B is not full rank. then AB is not full rank if and only if B is not full rank True. ∀x if x ∈ N (AV2 ). then N (AV2 ) = {0}. then V2 x ∈ N (A) = R(V1 ).    1 1 A= . Ax = 0. then B = A−1 C. (g) A is not full rank ⇒ there is an x 6= 0. 0 1 (f) If A is invertible.  (c) If V = V1 V2 is invertible and R(V1 ) = N (A).t. (d) rank([A B]) = rank(A) = rank(B) =⇒ R(A) = R(B) True. Since V2 is full rank and skinny therefore N (V2 ) = {0}. But V is invertible therefore R(V1 ) ∩ R(V2 ) = 0. such that Ax = 0 then dimN (A) ≥ 1 therefore rank(A) ≤ n − 1 which is not full rank. (e) x ∈ N (AT ) ⇐⇒ x ∈ / R(A) False. True. m ≥ n. If A ∈ Rm×n is square or skinny. If A fat there is always an x s. such that Ax = 0 True. A invertible =⇒ AB is not full rank obvious. A−1 invertible =⇒ A−1 C = B is not full rank. Define C = AB. Then if there is an x 6= 0. Use the first conclusion. 4 . you should specify the sequence of actions Reza should take. otherwise Bobbie is the winner. Then he can add x to the selected cell and subtract x from all adjacent cells. If your answer is negative. Zeroing out the board. end if i<d a(d*(i)+j)=-1. some have three. (a) We represent every 6 × 6 table by a vector in s ∈ R36 . (Some cells have four adjacent cells. (b) Can Bobbie fill in the table so that Reza has no possible way of winning the game? If your answer is positive. the table derived after a sequence of actions will be s(0) + i xi ai = s(0) +Ax where A is a matrix whose columns are ai ’s. Solution. If your answer is negative. a(d*(i-1)+j)=1. Bobbie fills the board with 36 arbitrary real numbers and then Reza performs a sequence of actions: At each step. Let s(0) ∈ R36 represent the initial configuration. he wins the game. So we are looking for an input x such that s(0) + Ax = 0. and some have two. end 5 . P Thus. and an arbitrary real number x. can Reza win the game? If you believe the answer is positive. Bobbie and Reza are playing a game.) Reza’s goal to perform a sequence of allowed actions to derive a table which consists of 36 zeros. (a) If Bobbie writes 1 in a corner cell (and 0 elsewhere). First. you should prove that Reza can turn any initial table into zero with a sequence of allowed actions. The action associated with the real number x and the ith cell is equivalent to adding a vector xai ∈ R36 to s where   j denotes the selected cell i 1 (ai )j = −1 j denotes an adjacent cell to the selected cell i   0 Otherwise. If Reza can derive the table consisting of zeros. if i>1 a(d*(i-2)+j)=-1.2.1). This game is played on a 6 × 6 board as follows. Reza is allowed to choose one cell. you should prove that there exists an initial table that Reza cannot turn into zero. for i=1:d for j=1:d a=zeros(d^2. you should prove that there is no possible sequence of actions that Reza can take to zero out the table. (c) Solve part b for a 9 × 9 table. The following code solves the problem d=6 A=[]. end if i<d a(d*(i)+j)=-1. if i>1 a(d*(i-2)+j)=-1. clc for d=[6.d.if j>1 a(d*(i-1)+j-1)=-1. a(d*(i-1)+j)=1. for i=1:d for j=1:d a=zeros(d^2. if rank([A.1). end if j<d a(d*(i-1)+j+1)=-1.9] A=[].1). end A=[A. end 6 . end end s = zeros(d*d. end if j>1 a(d*(i-1)+j-1)=-1. it suffices to see if A has zero nullspace.s]) == rank(A) reshape(A\s. The following code solves the problem. M =−  9 0 −9 −6 13 −6 2  1 4 −1 −9 −2 8  3 2 −5 −6 8 16 (b) The problem is equivalent to verifying that the linear transformation defined by Ax is onto.a].d) end We see that the answer will be   17 2 −9 −6 1 3  2 −6 −5 2 4 2    1 −9 −5 8 9 −1 −5 . Since A is square. s(1) = -1. (c) The code from part b shows that the transformation is not onto. the dimension of nullspace is %d\n’.d.if j<d a(d*(i-1)+j+1)=-1.a]. since the transformation is onto. end A=[A. end end fprintf(’for d=%d.d^2-rank(A)) end We see that Reza can always win. 7 . so Bobbie can select a good initialization to win. . . yi ). where t is a positive integer. f1 . Solution. (d) Suppose that there is an arrangement of the coins such that it is not possible for the robot to collect all the coins. . the first coordinate at time t will be equal to bTt Af where 1 1 bt = [t − . Let B ∈ Rn×n be a matrix whose ith column is bi and define C = B T A. The robot is at the origin at time t = 0 with zero velocity in the x direction. Define li to be the first coordinate of the location of the robot at time t = i. f2 . Plot the location of the coins and the location of the robot at integer times. we see that li = bTt Af. There are 2n coins in the plane and the goal is to design a sequence of input forces for the robot to collect the maximum possible number of coins. the only possible time to collect the ith coin is at time t = yi = i. so that the applied force is constant over time intervals of length 2. In this problem. · · · . · · · . Then we will have Af = [f1 . Hence. y2n ). describe a method to find whether the robot can collect them. The robot has a constant unit speed in the y direction (towards north). Suggest a way to check if the robot can collect all but one of the coins. We will apply a force at time t given by fj for 2j − 2 ≤ t < 2j where j = 1. . 0]T . . . Similar to the mass/force example. Report the input that results in collecting 2n − 1 coins. (e) Run your method on data in robot_coin_collector.3. Your answer should be a function of t and the vector of input forces f ∈ Rn . Consider a robot with unit mass which can move in a frictionless two dimensional plane. n. 2 2 (b) According to part a. we assume that yi = i. y1 ). 8 . we see that the necessary and sufficient condition to collect all the coins is that x ∈ R(C). . . fn ]. show that the robot cannot collect all the coins. (a) Find the coordinates of the robot at time t. (x2n .m and report which coin cannot be collected. (b) Given a sequence of k coins (x1 . From part a. and it is designed such that we can only apply force in the x direction. This can be simply examined with rank([C x])==rank(C).m. (c) For the data provided in robot_coin_collector. The robot is designed such that it can collect the ith coin only if it exactly passes through the location of the coin (xi . (a) The second coordinate at time t is simply equal to t. Then we will have l = Cf . Coin collector robot. Consider A ∈ R2n×n such that ( c 1 j = b i+1 2 Aij = 0 Otherwise. · · · . . 0. i+1:end]. Ct = C([1:i-1.(c) The code to solve parts c.xt])==rank(Ct) fprintf(’The robot can collect all coins but %dth.i)=1.i+1:end]).1:i) = i-1/2:-1:1/2. (e) The following code solves the problem: clc clear all close all robot_coin_collector BT = zeros(2*n.2*n). (d) In part b.\n’. We know that there exists a sequence of input forces f such that all but one of the 2n equations are satisfied. if rank([Ct. If we can collect all coins but the ith one. for i=1:2*n BT(i. end A = zeros(2*n. We will loop over the coins and see whether it’s possible to collect all coins but one. Likewise.:).n). end C = BT*A. Let x(i) be the location vector x with the ith entry removed.2*i]. then we will certainly have x(i) ∈ R(C (i) ). we saw that l = Cf .x])==rank(C) fprintf(’All coins can be collected!\n’) else fprintf(’All coins cannot be collected!\n’) end %part e for i=1:2*n xt = x([1:i-1. disp(input) end end 9 .i).e can be find at the bottom. fprintf(’and the input will be: \n’) input = Ct\xt. but we don’t know which one. %part c if rank([C. for i=1:n A([2*i-1. let C (i) be the transition matrix with the ith row of C removed. 20. −35.0000.1:2*n.0000.’r’) hold off We see that all coins but the 7th can be collected and the associated input will be f = [1. 10 . 7.0000].0000. −4.12 10 8 6 4 2 0 −10 −5 0 5 10 15 20 25 Figure 1: Location of the coins and the trajectory of the robot hold on plot(C*input.0000.0000. −10. (a) The set of solutions which can satisfy the constraint is the set of x for which the following is true: 20 = [5 2 1 0] ∗ x. Certain generators are more efficient for providing power to some of the sites than others. To avoid typos. the generator table and site requirements can be found at powerGen. Site A Site B Site C Site D Site E Site F Site G Generator 1 5 1 0 0 3 2 1 Generator 2 2 1 1 3 2 0 3 Generator 3 Generator 4 1 0 2 3 2 4 3 1 1 1 3 1 0 2 Here is the amount of power each site estimates it will use for the year: Site A 20 Site B 5 Site C 3 Site D 4 Site E 10 Site F 5 Site G 5 The goal is to estimate how much money will be spent at each generator while trying to meet the sites’ estimates.4. has been given top priority.m. a hospital. though the goal is still to get as close as possible to meeting every site’s request. Find the tradeoff curve showing how close the other sites can get to their estimates as the requirement for Site A is relaxed. There is one requirement. Power generation for a city. (b) Generator 4 has stopped working. Each site submits an estimate of the amount of power it plans to use for the year. We can write this set as x = {x0 + z : z ∈ N ([5 2 1 0])}. Site A. Plot the sum of the squared deviation of what Sites B through G request and receive versus the difference squared between what Site A requests and what it receives. (a) Find the vector of money spent for each generator that minimizes the sum of the squared deviation between the sites’ power requested and power generated. Be sure to explain your process and how you arrived at your answer. and therefore must receive the exact amount of power it has requested. Solution. Here is what we want you to answer. The other sites are allowed to receive a little more or less than the power it requested. The following table provides a list of the generators and the amount of power it can generate per unit cost for each site. provided that Site A receives its exact estimate. 11 . A city has a series of generators that provide power to several key sites. however. Let N be a basis for N ([5 2 1 0]).      2 0 3   5  1 3 0 5 Our least squares objective function becomes .0039  0. where w is the vector we have control over. we have Minimize e w − (e e 0 )||2 .0702 (b) This is a straightforward least squares problem with a weighted sum objective.  10  . Thus. x0 = [4 0 0 0]T ).6084  0.9771   x=  0. yˆ =   3 2 1 . we have the following least squares problem. ||A(x Minimize e is the matrix A with the top row removed and ye is the vector y with the where A first entry removed. (i.where x0 is an arbitrary solution. Define     1 1 2 5  0 1 2   3       0 3 3   4    Aˆ =  a ˆ = [5 2 1]. ||AN y − Ax and so e )T (AN e ))−1 (AN e )T (e e 0 ). w = ((AN y − Ax and x = x0 + N w. This gives us the following cost vector:   3.e. e 0 + N w) − ye||2 . Then x = x0 + N w. We first remove the last column of the A matrix since Generator 4 no longer works. Rearranging some terms around. .    . . 2 . . a ˆ 20 . . . . 2 2 ˆ . . ||ˆ ax − 20|| + µ||Ax − yˆ|| = . . √ ˆ x − √ µˆ y . . powerGen % Part a 12 . µA . We then loop over values of µ to generate the tradeoff curve. The following is Matlab code which calculates the solution for parts (a) and (b). y_hat). w = (A_tilde*N) \ (y_tilde . sqrt(mu(ind))*A_hat].1:20]. N = null([5 2 1 0]). obj2(ind) = sum((A_hat*x . x = (newA)\newy.0]. A_tilde = A(2:end.A_tilde*x0). end plot(obj1. 1:3). y_tilde = y(2:end). y_hat = y(2:end). % Multi-object least squares when mu > 0 else newA = [a_hat.0.6084 % 0. mu = [0:0. end obj1(ind) = (a_hat*x .A_tilde*x0).0.0. a_hat = A(1. ylabel(’Sites B-G’’s difference’). newy = [20. :). for ind = 1:length(mu) % Solve constrained least squares when mu = 0 if (ind == 1) x0 = [4. obj2).9771 13 . N = null([5 2 1]). x_constrained = x0 + N*w % Part b A_hat = A(2:end. y_tilde = y(2:end). % Output: % x_constrained = % % 3.^2). xlabel(’Site A’’s difference’).1:3). sqrt(mu(ind))*y_hat].1:3).x0 = [4. w = (A_tilde*N) \ (y_tilde .0].20)^2. x = x0 + N*w. A_tilde = A(2:end. 0039 0.0.0702 25 Sites B−G’s difference % % 20 15 10 5 0 0 5 10 15 20 Site A’s difference 14 25 30 . hM is the impulse response of the channel and v1 . . . vN is some noise term. . . . . . Plot the residual J as a function of the impulse response length. . In order to estimate the impulse response of the channel. respectively. yn runs from n = 1. Using the channel you found in part (b). There are three parts to this question: (a) Using the data provided in channel. Is 4 a reasonable estimate? What would you recommend as a good length for the impulse response? (c) You receive more output from the channel (stored in the variable y_unknown). find and make a stem plot (using Matlab’s stem command) of your estimated signal xn for n = 1. m=1 Assume that xn = 0 for n ≤ 0. . . except now you don’t know what the input signal is. . One thing that we have left out is the length of the impulse response. . xN and output y1 . . We can get around this problem by iterating over the lengths of the channel and observing how the residual behaves. 15 . (b) Iterate your solution from part (a) assuming the length of the impulse response is 3.5. 10 and give the corresponding residuals. Explain how you arrived at those coefficients. . . . . . . Solution. . . . . . . . . the input x1 . . . N . Our task is to estimate the channel which minimizes the following objective function: J= N X yn − n=1 M X !2 hm xn−m+1 . Estimating the channel. Also report the residual. m=1 where h1 . find the impulse response of the channel assuming the length of the impulse response is 4. . it is typical to send a known input sequence through the channel. . yN are related by the following equation: yn = M X hm xn−m+1 + vn for n = 1.m. N. In a communications channel. N + 10. and from the output deduce the channel coefficients. The known input and output signals are stored in the variables x_known and y_known. although xn = 0 for n > N . . 0080  1.1721  −0.3141  −0. we have y1 y2 y3 y4 y5 = h1 x1 = h1 x2 + h2 x1 = h1 x3 + h2 x2 + h3 x1 = h1 x4 + h2 x3 + h3 x2 + h4 x1 = h1 x5 + h2 x4 + h3 x3 + h4 x2 ..(a) Using the equation for yn given to us.0166     −0. (Increasing the channel beyond that gives minimal improvement). we simply add another column to our matrix A.0958   h=  0. .1672     −0.   .2955 16 . we can express our input/output relation as   x1 0 0 0  x2 x1 0 0     x3 x2 x1 0      x4 x3 x2 x1      y =  x5 x4 x3 x2    x6 x5 x4 x3      x7 x6 x5 x4      .2711  0. a length 7 channel seems to be a good length. x40 x39 x38 x37 {z } |  h1 h2  .0114     1.1192 h=    −0.1205 (b) As we increase the length of the channel. y40 = h1 x40 + h2 x39 + h3 x38 + h4 x37 Thus. h3  h4 A The channel is given by h = (AT A)−1 AT y. We see in the figure that while a length 4 channel is a big improvement over a length 3 channel.. The length 7 filter is:   0. which gives us   0. . 0   x2      h5 h4 h3 h2 h1 0 0 0 .   0 h h h h h h h . 0   x3     y =  h h h h h h 0 0 .1)..^2). end hGuess = A\y_known. Our matrix will now contain the values of the filter we recovered from part (b). . for M = 3:10. 0      h3 h2 h1 0 0 0 0 0 .M).    . end residuals(3:10) % Part c 17 . The residual we get is 0. .x_known(1:end-(ind-1))].1). ... 0   . A = zeros(N. and will be skinny (since the output y is longer than the input x). .. . % Part a M = 4.1)... 0  7 6 5 4 3 2 1   x39   . 0 Note that the last few rows of the matrix are zero because the filter length is only 7.x_known(1:end-(ind-1))].ind) = [zeros(ind-1.  6 5 4 3 2 1  4   h7 h6 h5 h4 h3 h2 h1 0 . channel. Here is what the setup looks like   h1 0 0 0 0 0 0 0 . for ind = 1:M A(:. .ind) = [zeros(ind-1. .(c) The roles of h and x are reversed.M). 0  x .. 0  h2 h1 0 0 0 0 0 0 . . .. end h4 = A\y_known % Part b residuals = zeros(10. . 0  x1    h4 h3 h2 h1 0 0 0 0 . 0 0 . for ind = 1:M A(:.4962. residuals(ind)= sum((y_known . A = zeros(N. .A*hGuess).   . The following is Matlab code which calculates the solution. residual = sum((y_unknown . ylabel(’x[n]’. column(1:M) = hBest.N).ind) = [zeros(ind-1. xlabel(’channel length’. ’fontSize’.% 7 seems to be reasonable.0080 % 1. fSize) figure(2) stem(x_recovered). so we recover that filter M = 7. end hBest = A\y_known % Now recover x from y_unknown H = zeros(N+10.1). ’fontSize’.1). fSize) % Output % h4 = % % 0. ’fontSize’. title(’Recovered x’. column = zeros(N+10.3245 18 .0958 % 0. for ind = 1:M A(:.H*x_recovered). fSize).1205 % % % ans = % % 109. ’fontSize’. figure(1) plot([3:10].1721 % -0. ylabel(’residual’.column(1:end-(ind-1))]. fSize).1). A = zeros(N. end x_recovered = H\y_unknown. for ind = 1:N H(:. fSize).^2) fSize = 40. fSize). set(gca. xlabel(’n’.M). fSize).x_known(1:end-(ind-1))].’fontSize’. set(gca. residuals(3:10)). ’fontSize’.8208 % 10.’fontSize’.ind) = [zeros(ind-1. 3141 % -0.1672 % -0.9878 % 0.1192 % -0.0166 % -0.2711 % 0.2955 % % % residual = % % 0.9635 % 0.0975 % 0.% 10.2338 % 6.4962 120 100 residual 80 60 40 20 0 3 4 5 6 7 channel length 19 8 9 10 .9592 % % % hBest = % % 0.0114 % 1.9672 % 0. Recovered x 3 2 x[n] 1 0 −1 −2 −3 0 5 10 15 20 n 20 25 30 35 40 . . In another words. Then we can solve the dynamics of the smaller scale linear system very fast and use the dynamics to generate next power outputs. . T (1).6. . current temperature distribution. You are given these records p(1). Now we consider a even simpler model: the temperature increase rate of each sensors is a linear function of the lamp powers all the time. etc. . this method usually does not work well. . . and the position of lamps. we want to choose the matrix A to minimize N 1/2  1 X 2 kT (t) − T (t − 1) − Ap(t)k2 N − 1 t=2 21 . . and T ∈ R4 are the measured temperatures from the 4 thermocouples. It is often required that the temperature increase rate is constant. We already took the temperature measurement and recorded lamp power outputs. we assume all A(t) are the same. To achieve active lamp power control. . Heating process is a usually critical process in chemical synthesis. T (t) − T (t − 1) = A(t)p(t). 3. there are 3 lamps located in different positions and there are 4 thermocouples to monitor the temperature in the heating area. But due to the environment’s fluctuations and the time consuming of solving PDE problems. so we have T (t) − T (t − 1) ≈ Ap(t). . T (N ). . in reality. Since now we are considering the simplest model. N . Here is the problem. we could (a) solve heating transfer differential equations to get the nonlinear relationship between the temperature increase rate and lamp powers and current temperature profiles. but unfortunately. Heating lamp power control. are the power outputs of the 3 lamps. A heating chamber usually consists of several lamps for heating and several temperature sensors (for example. (b) Assume the relationship between temperature increase rate and lamp powers and current temperature is linear in a small time and temperature interval. thermocouples) for monitoring. . the temperature increase rate is a nonlinear function with lamp powers. p(N ). In a heating system in 2D space. based on target temperature increase profile. where p(t) ∈ R3 . The method works by choosing A that minimizes the RMS (root-mean-square) of the prediction error over t = 2. Where the matrix A(t) ∈ R4×3 is the parameter matrix of the model. . Now we assume at each discrete time t. This shows that the problem is in fact separable. Solution. We can express matrix A in terms of rows   a ˜T1   Aj =  . 3. The l2 norm of the ith error component is ||ei ||2 = ||P a ˜i − δTi ||2 . 22 . T (N ) and a power supply record matrix   p = p(1) p(2) .. the minimization of the global error is equivalent to independent minimization of the errors due to each component.(a) Explain how to obtain A. and compute the RMS prediction error. After changing the order of summation you obtain the expression for the l2 norm of the time course of a single component ei . 4. a ˜T4 Let ei (t) be the ith component of the vector e(t). The RMS value of the prediction could be written as  N N X 4 1/2  1 X 1/2 1 X 2 = kT (t) − T (t − 1) − Ap(t)k2 ei (t)2 N − 1 t=2 N − 1 t=2 i=1 4 N 4 1/2  1 X 1/2 1 XX 2 = ei (t) kei k22 = N − 1 i=1 t=2 N − 1 i=1  Where ei denotes the i th prediction error component for all time instance. The first operation follows from the definition of the l2 norm of the error vector at a particular time instance. .. p(N ) Find the matrix A which minimizes the RMS of the prediction error. The prediction error at time t is e(t) = T (t) − T (t − 1) − Ap(t). . (b) Implement the method.  . . . given the records T (t) and p(t). 2. i = 1. This file contains a temperature record matrix   T = T (1) T (2) .m. and apply it to the data given in the file temp_control_data. It is given by ei (t) = Ti (t) − Ti (t − 1) − a ˜Ti p(t). where    P =  pT (2) pT (3) .2:N)-T(:. . Ti (N ) − Ti (N − 1)      for i = 1.0088 0.2:N)-T(:. 2. Execution of the code below produces the  0.2:N))..2:N)’. .^2))). By defining δT = [δT1 .0171 0.1084.0195 following A estimation. 3. which. . .0168 0.0089  0.0110 associated RMS value of the prediction error is 0.  0. if matrix P is full rank. .0165 0. clear all.0221 0. δTi =    Ti (2) − Ti (1) Ti (3) − Ti (2) . P=p(:. .0214 Als =   0. i = 1. The ith error component is minimized by the least-squares approximate solution. 2.0235  0.1:N-1)-A_ls*p(:.0152 0. . 23 .1:N-1))’. 4. pT (N )        . . we have ATls = [˜ a1ls . 3.. delta_T=(T(:. . %Calculate least squares approximate solution A_ls=(inv(P’*P)*P’*delta_T)’.0094   0. 4. . a ˜4ls ] = (P T P )−1 P T δT. is given by a ˜ils = (P T P )−1 P T δTi . %Calculate RMS error value RMS=sqrt(1/(N-1)*sum(sum((T(:. so Als = ((P T P )−1 P T δT )T . δT4 ].
Copyright © 2024 DOKUMEN.SITE Inc.