Digital Signal Processing Reference
In-Depth Information
Example E.2
Initialize the following matrix:
24 10
52
A =
3 9
+
=( A T A )
1 A T with T denoting
and take the pseudo-inverse of A , defined as A
the conjugate transpose operation.
Solution
The following M ATLAB code initializes matrix A :
>>A=[24-10;5239]; %Thesemicolon inside square
% parenthesis separates
% adjacent rows of a matrix
An alternative but longer set of instructions for the initialization of A is as
follows:
>> A(1,1)=2; A(1,2)=4; A(1,3)=-1; A(1,4)=0;
>> A(2,1)=5; A(2,2)=2; A(2,3)=-3; A(2,4)=9;
To calculate the pseudo-inverse of A , the following instruction may be used:
>> Ainverse = inv(A'*A)*A'; % Function inv calculates
% inverse of a matrix
% while ' denotes conjugate
% transpose
which returns a warning that the matrix is singular. From linear algebra, we
know that the inverse of a matrix only exits if it is non-singular, hence the
pseudo-inverse does not exist for the above choice of A .
Example E.3
Initialize the following discrete-time function:
π
15
f [ k ] = 2 cos
k
for
0 k 30 .
Solution
As in other high-level languages, we can use a for statement to initialize the
function f . The code is given by
Search WWH ::




Custom Search