ECE410F Lab 2 – Linear Control Systems Numerical Linear Algebra and Controllability

$30.00

Category: Tags: , , , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

Main concepts of this lab
■ How to find the basis for the image of a matrix.
■ How to find a basis for the sum and intersection of two subspaces.
■ How to find coordinates of v ∈ Rn
in a given basis {v
1
, . . . , v
n}.
■ How to find the matrix representation of an LT L : Rn → Rm in given bases {v
1
, . . . , v
n} and
{w
1
, . . . , w
m}.
■ How to check rank, injectivity, surjectivity of LTs.
■ How to check whether an equation Ax = b has a solution, whether such solution is unique, and how
to find a particular solution.
■ How to check A-invariance of a subspace and find the normal form of the representation theorem.
■ How to check controllability of a pair (A, B) and perform the Kalman decomposition.
1 Introduction
At the end of the previous lab, you arrived at various representations of a linearized model of a control
system, including transfer function form, zero-pole form, and state space form. In this course, our
primary focus is on the analysis of linear systems in state space form, which strongly relies on the
machinery of linear algebra. In this lab you will review the basic techniques of numerical linear algebra,
and then apply those techniques to the analysis of a simple linear system.
Throughout the lab, you will be guided through a number of steps which will require you to write
Matlab code. You will write your code in a Matlab script called labx.m, where x is the lab number. You
will submit this code as a group. Your code should provide certain outputs (figures, numbers, and the
like). A request for output is highlighted with a shaded area of text, such as the following.
1
Output 1. Print the eigenvalues of the matrix.
Parts of the text containing directions for the writing of your Matlab code will be highlighted in a
different colour, such as this:
Create a function pendulum.m. The first line of the function will be
function xdot = pendulum(t,x,parameters)
2 Submission guidelines and mark breakdown
Marks are assigned to groups. Members of each group get identical marks, unless special circumstances
occur. The group lab mark will be made up of three components.
Matlab code 6 pts
Lab report 4 pts
Total 10 pts
Matlab code. Your code should be clean and readable, and it should contain abundant commentary,
so that the instructors may follow your development and check its correctness. This component of the
mark will be based on the correctness of the code and its readability, and it will be assigned as follows:
0 out of 6 the code is absent
1 out of 6 the code is largely incomplete
2 out of 6 the code is largely complete, but there are parts missing and the outputs are incorrect
3 out of 6 the code is complete, but it does not produce correct outputs
4 out of 6 the code is complete, it produces correct outputs, but there is no commentary in the
code, and/or the code is poorly organized
5 out of 6 the code is complete, correct, and contains some but insufficient commentary,
and/or its organization is below par
6 out of 6 the code is complete, correct, and the commentary and organzation are adequate so
that it is easy to read
Lab report. Write a concise report containing the requested outputs, but don’t just print out a bunch
of matrices and figures. Add some flesh to the outpus that are requested within the lab document so
that one can follow the logical development of the lab. Aim for a style like this:
Output 1. The following are the bases of the subspaces V and W that were obtained:
(…)
We observe that the columns of V were already linearly independent, while those of W weren’t.
We further note that (…).
2
Output 2. Below the solution of the differential equation. There are three figures. The first two
figures depict x1(t) and x2(t), while the third figure depicts the orbit.
Do not screenshot Matlab figures. Rather, save them as jpeg files (or other formats) and include then
in the report in the appropriate order.
When the lab document asks you to comment on something, strive to provide meaningful, insightful
commentary, that demonstrates you have understood your own work and how it connects to the course
concepts. This portion of the mark will be assigned as follows:
0 out of 4 the report is either absent, or a simple printout of the Matlab outputs without
commentary
1 out of 4 the report is incomplete and the commentary is inadequate
2 out of 4 the report is incomplete xor the commentary is inadequate
3 out of 4 the report is complete and the commentary is adequate, but lacks insight/clear
understanding
4 out of 4 the report is complete and the commentary is adequate and demonstrates clear
understanding
3 Numerical linear algebra
In this lab, it is assumed that you have read the linear algebra chapter in the textbook, and have reviewed
the lecture notes on this subject. If you haven’t, this is a good time to do it.
3.1 Basic operations on subspaces
In this section, you will use the following Matlab commands.
Matlab commands
orth(A) Find an orthogonal basis for the column space of A
null(A) Find an orthogonal basis for the null space of A
inv(A) Find the inverse of A
Let X be an n-dimensional vector space, and let V, W be two subspaces of X . Two key operations
involving these subspaces are the subspace sum V + W and subspace intersection V ∩ W. In this section
we will explore how to represent these subspaces numerically, and algorithms for performing these two
operations.
Let A ∈ Rn×m be a matrix. Recall that the image of A is simply the span of the columns of A
Im(A) = span{a
1
, . . . , a
n
}
where a
i
is the ith column of A. This fact motivates us to use matrices to represent subspaces. In order
to computationally convenient and remove redundancy, we will need a procedure to find a basis for the
image of a matrix. Matlab’s orth function does exactly this.
3
Consider R4 and the subspaces
V = span









1
−1
0
1






,






1
1
0
0






,






3
1
0
1









and W = span









1
0
2
1






,






1
0
−2
0









Using the Matlab orth function, begin your lab2.m script by finding bases for these subspaces.
Output 1. Print the matrices containing the bases of these subspaces. Comment on any interesting
details. Are the given vectors linearly independent? What has happened to the basis for W?
We now want to develop procedures for finding the subspace sum and intersection. First we address
the subspace sum. Recall the definition:
V + W = {x ∈ X : x = v + w, v ∈ V, w ∈ W} .
If we have V = Im(V) and W = Im(W) for suitable matrices V and W, then
V + W = Im V W.
Using this fact, do the following.
Create a function sub_sum.m. The first line of the function will be
function C = sub_sum(A, B)
The input matrices A and B contain bases for the subspaces we wish to sum. The matrix C that is to be
returned should contain a basis for the sum of the subspaces.
The procedure for finding the intersection is slightly more involved. Suppose that V and W are land m-dimensional subspaces respectively, so that V ∈ Rn×l and W ∈ Rn×m. For a vector x to be in
V ∩ W, it must be the case that there exist vectors λ ∈ Rl
, µ ∈ Rm such that
x = Vλ = Wµ .
Rearranging this, we get
0 =

V − W


λ
µ
#
.
For any vector ”
λ
µ
#
in the null space of
V − W

, the vector x = Vλ = Wµ will be in Im(V) ∩ Im(W).