20105ee103_1_hw7_sols

20105ee103_1_hw7_sols - L. Vandenberghe 11/18/10 EE103...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: L. Vandenberghe 11/18/10 EE103 Homework 7 solutions 1. Exercise 11.3. As in exercise 11.2, we can express the end state of the first vehicle as a function of the actuator input, using the recursion s ( t + 1) = Fs ( t ) + gu ( t ) , s (0) = 0 , where F = bracketleftBigg 1 1 0 0 . 95 bracketrightBigg , g = bracketleftBigg . 1 bracketrightBigg . The end state is s ( N ) = Bu where B = bracketleftBig F N 1 g F N 2 g Fg g bracketrightBig , u = ( u (0) , u (1) , . . . , u ( N 1)) . Similarly, if we define G = bracketleftBigg 1 1 0 0 . 8 bracketrightBigg , h = bracketleftBigg . 2 bracketrightBigg , then the end state of the second vehicle is p ( N ) = bracketleftBigg 1 bracketrightBigg + Cv where C = bracketleftBig G N 1 h G N 2 h Gh h bracketrightBig , v = ( v (0) , v (1) , . . . , v ( N 1)) . To formulate the problem as a least-norm problem we define a 2 N-vector of variables x = ( u (0) , u (1) , , u ( N 1) , v (0) , v (1) , , v ( N 1)) . We are asked to minimize bardbl x bardbl 2 subject to the three conditions s 1 ( N ) = p 1 ( N ) , s 2 ( N ) = 0 , p 2 ( N ) = 0 . These are three linear equations in x , and equivalent to Ax = b with A = B 21 B 22 B 2 ,N 1 B 2 N C 21 C 22 C 2 ,N 1 C 2 N B 11 B 12 B 1 ,N 1 B 1 N C 11 C 12 C 1 ,N 1 C 1 N b = 1 . The first equation is the condition s 2 ( N ) = 0. The second equation states p 2 ( N ) = 0. The third equation states s 1 ( N ) = p 1 ( N ). The Matlab code is as follows. 1 N = 20; F = [1 1; 0 0.95]; g = [0;0.1]; G = [1 1; 0 0.8]; h = [0;0.2]; B = zeros(2, N); C = zeros(2, N); B(:,N) = g; C(:,N) = h; for t = N-1:-1:1 B(:,t) = F*B(:,t+1); C(:,t) = G*C(:,t+1); end; A = [ B(1,:),-C(1,:); B(2,:), zeros(1,N); zeros(1,N), C(2,:)]; b = [1;0;0]; x = A*((A*A)\b); u = x(1:N); v = x(N+[1:N]); % simulate the two systems and plot s = zeros(2,N+1); p = zeros(2,N+1); p(1,1) = 1; for t = 1:N s(:,t+1) = F*s(:,t) + g*u(t); p(:,t+1) = G*p(:,t) + h*v(t); end; plot(0:N, s(1,:), -, 0:N, p(1,:), --) The solid line in the figure is s ( t ). The dashed line is p ( t )....
View Full Document

Page1 / 10

20105ee103_1_hw7_sols - L. Vandenberghe 11/18/10 EE103...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online