Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

**Write a MATLAB function A= toeplitz (m, n, a ) which produces an Toeplitz matr

ID: 3782941 • Letter: #

Question

**Write a MATLAB

function A= toeplitz (m, n, a)

which produces an Toeplitz matrix using the entries of an (m+n-1)x1 vector a, by assigning

A(i,j) = a(n+i-j) i= 1:m j= 1:n

**Type the function toeplitz in your diary file.

(1) **Run the function A= toeplitz (m, n, a)

on the following sets of variables. Display vector a for each of the below.

(a) m=4; n=3; a=transpose([1:6])

(b) m=3; n=4; a=randi(10,6,1)

(c) m=4; n=4; a=[zeros(3,1) ; [1:4]]

(2) **Construct a vector a that will define a 5 by 5 Toeplitz upper diagonal matrix with the random integer entries that range between 10 and 100. Display the vector a.

**Run the function A= toeplitz (m, n, a) for the variables indicated above.

(3) **Output a 4 by 4 identity matrix by running the function A= toeplitz (m, n, a) on the corresponding set of variables. Display the vector a.

Explanation / Answer

diary data1.txt;
sprintf('First Data ');
m=4
n=3
a=transpose(1:6)
A=toeplitz(m,n,a)

sprintf('Second Data ');
m=3
n=4
a=randi(10,6,1)
A=toeplitz(m,n,a)

sprintf('Third Data ');
m=4
n=4
a=[zeros(3,1) ; [1:4]']
A=toeplitz(m,n,a)

% Any matrix can create upper triangular matrix;which start with (n-1) zeros
% and for lower triangluar matrix; last (n-1) zeros
% for Diagonal matrix mid element is non zero
sprintf('Upper Triangular Matrix ');
m=5
n=5
r=randi([10 100],5,1)
a=[zeros(4,1);r];
A=toeplitz(m,n,a)

sprintf('Diagonal Matrix ');
m=5
n=5
r=randi([10 100],1,1)
a=[zeros(4,1);r;zeros(4,1)];
A=toeplitz(m,n,a)

%%%%%%%%Output


m =

4


n =

3


a =

1
2
3
4
5
6


A =

3 2 1
4 3 2
5 4 3
6 5 4


m =

3


n =

4


a =

4
10
5
2
10
10


A =

2 5 10 4
10 2 5 10
10 10 2 5


m =

4


n =

4


a =

0
0
0
1
2
3
4


A =

1 0 0 0
2 1 0 0
3 2 1 0
4 3 2 1


m =

5


n =

5


r =

49
20
33
47
64


A =

49 0 0 0 0
20 49 0 0 0
33 20 49 0 0
47 33 20 49 0
64 47 33 20 49


m =

5


n =

5


r =

33


A =

33 0 0 0 0
0 33 0 0 0
0 0 33 0 0
0 0 0 33 0
0 0 0 0 33

Run_program