Question: Just need Mathlap code 10.1 Minimum-energy optimal control. A simple model of a vehicle moving in one dimension is given by si(t 1) s2(t 1)

Just need Mathlap code
10.1 Minimum-energy optimal control. A simple model of a vehicle moving in one dimension is given by si(t 1) s2(t 1) u(t), t=0, 1, 2, . o 0.95s2(t) s1(t) is the position at time t, s2(t) is the velocity at time t, and u(t) is the actuator input. Roughly speaking, the equations state that the actuator input affects the velocity, which in turn affects the position. The coefficient 0.95 means that the velocity decays by 5% in one sample period (for example, because of friction), if no actuator signal is applied. We assume that the vehicle is initially at rest at position 0: s1(0) 2(0) 0. We will solve the minimum energy optimal control problem: for a given time horizon N, choose inputs u(0)u(N 1) so as to minimize the total energy consumed, which we assume is given by E-u(t) t-0 In addition, the input sequence must satisfy the constraint si (N) bring the vehicle to the final position si(N) 10 with final velocity s2(N)-0, as efficiently as possible 10, s2(N) 0, Our task therefore is to (a) Formulate the minimum energy optimal control problem as a least norm problem minimize ll 12 subject to Ca d Clearly state what the variables r, and the problem data C and d are. (b) Solve the problem for N (c) Solve the problem for N 30. Plot the optimal u(t), the resulting position si(t), and velocity s2(t) 2,3,...,29. For each N calculate the energy E consumed by the optimal input sequence. Plot E versus N. (The plot looks best if you use a logarithmic scale for E, i.e., semilogy instead of plot.) (d) Suppose we allow the final position to deviate from 10. However, if sl (N)10, we have to pay a penalty, equal to (s1(N) - 10)2. The proble is to find the input sequence that minimizes the sum of the energy E consumed by the input and the terminal position penalty u(t)2 + (sl (N)-10)2. subject to the constraint s2(N)-0. Formulate this problem as a least norm problem, and solve it for N-30. Plot the optimal input signals u(t), the resulting position si(t) and the resulting velocity s2(t). Remark. If C has liearly independent rows, then the MATLAB command x-C d computes a solution to Cr = d, but it is not the least norm solution. We can use the command x C, * ((C*C") \ d) to compute the least norm solution. We can also use the QR factorization method, using the code [Q, R] -qr(C', 0); 10.1 Minimum-energy optimal control. A simple model of a vehicle moving in one dimension is given by si(t 1) s2(t 1) u(t), t=0, 1, 2, . o 0.95s2(t) s1(t) is the position at time t, s2(t) is the velocity at time t, and u(t) is the actuator input. Roughly speaking, the equations state that the actuator input affects the velocity, which in turn affects the position. The coefficient 0.95 means that the velocity decays by 5% in one sample period (for example, because of friction), if no actuator signal is applied. We assume that the vehicle is initially at rest at position 0: s1(0) 2(0) 0. We will solve the minimum energy optimal control problem: for a given time horizon N, choose inputs u(0)u(N 1) so as to minimize the total energy consumed, which we assume is given by E-u(t) t-0 In addition, the input sequence must satisfy the constraint si (N) bring the vehicle to the final position si(N) 10 with final velocity s2(N)-0, as efficiently as possible 10, s2(N) 0, Our task therefore is to (a) Formulate the minimum energy optimal control problem as a least norm problem minimize ll 12 subject to Ca d Clearly state what the variables r, and the problem data C and d are. (b) Solve the problem for N (c) Solve the problem for N 30. Plot the optimal u(t), the resulting position si(t), and velocity s2(t) 2,3,...,29. For each N calculate the energy E consumed by the optimal input sequence. Plot E versus N. (The plot looks best if you use a logarithmic scale for E, i.e., semilogy instead of plot.) (d) Suppose we allow the final position to deviate from 10. However, if sl (N)10, we have to pay a penalty, equal to (s1(N) - 10)2. The proble is to find the input sequence that minimizes the sum of the energy E consumed by the input and the terminal position penalty u(t)2 + (sl (N)-10)2. subject to the constraint s2(N)-0. Formulate this problem as a least norm problem, and solve it for N-30. Plot the optimal input signals u(t), the resulting position si(t) and the resulting velocity s2(t). Remark. If C has liearly independent rows, then the MATLAB command x-C d computes a solution to Cr = d, but it is not the least norm solution. We can use the command x C, * ((C*C") \ d) to compute the least norm solution. We can also use the QR factorization method, using the code [Q, R] -qr(C', 0)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
