0% found this document useful (0 votes)
24 views18 pages

Signals Lab 025 PDF

This document contains the solutions to signals and systems lab questions for a student named Shoaib Tahir enrolled in course 02-132222-025. The questions involve operations on vectors and matrices such as addition, multiplication, inverse, determinant, and matrix/vector generation functions like ones, zeros, linspace, and logspace.

Uploaded by

shoaib tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views18 pages

Signals Lab 025 PDF

This document contains the solutions to signals and systems lab questions for a student named Shoaib Tahir enrolled in course 02-132222-025. The questions involve operations on vectors and matrices such as addition, multiplication, inverse, determinant, and matrix/vector generation functions like ones, zeros, linspace, and logspace.

Uploaded by

shoaib tahir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

BAHRIAUNIVERSITY

(Karachi Campus)

NAME: SHOAIB TAHIR

ENROLLMENT:02-132222-025

COURSE: Signals & Systems Lab


QUESTION 1:

v=[1:5]

v=

1 2 3 4 5

a) v(2)

ans =

2
Output

w=[5:9]

w=

5 6 7 8 9

b) sum=v+

w sum =

6 8 10 12 14

Output:
v=[1 2 3 4];
w=[2 3 6 3];
diff= v-w

c) diff =

-1 -1 -3 1

Output:

v=[1 2 3 5];
w=[1 6 8 3];
d) vw= [v w]

vw =

1 2 3 5 1 6 8 3
Output:

e) vw(2:6)
ans =

2 3 5 1 6
Output:

v=[ 2 3 7 6];

f) v'

ans =

2
3
7
6
Output:

QUESTION 2:

z=[1;1;0;0]

z=

1
1
0
0
a)

z'

ans =

1 1 0 0
Output:

z= [1;1;0;0]

z=

1
1
0
0

v=[ 2 4 5 7]

v=

2 4 5 7

b) z*v

ans =

2 4 5 7
2 4 5 7
0 0 0 0
0 0 0 0

output:

v=[2 3 5 6]

v=

2 3 5 6

w=[ 2 4 6 4]

w=

2 4 6 4

c) [v;w]

ans =

2 3 5 6
2 4 6 4

Output:
v

v=

2 3 5 6

z=[1;1;0;0]

z=

1
1
0
0

d) v*z

ans =

Output:

z=
1
1
0
0

v=

2 3 5 6

e) [z;v']

ans =

1
1
0
0
2
3
5
6

Output:
F) z+v'

ans =

3
4
5
6

Output:

Question 3:

m=[ 1 2 ; 3 5]

m=

1 2
3 5

a) N=inv(m)

N=
-5.0000 2.0000
3.0000 -1.0000

Output:

b) m*

N ans =

1.0000 -0.0000
0 1.0000

Output:

c) i= eye(2)
i=

1 0
0 1

Output:

d) m+i

ans =

2 2
3 6

Output:

e) m*z(1:2)

ans =

3
8

Output:
f) v(3:4)*m

ans =

23 40

Output:

g) m(1,1)

ans =

Output:

h) m(1:2,1:2)
ans =

1 2
3 5

Output:

i) m(:,1)

ans =

1
3

Output:

J) m(2,:)

ans =

3 5
Output:

Question 4
a)

ones(3)

ans =

1 1 1
1 1 1
1 1 1

ones(3,2)

ans =

1 1
1 1
1 1

Output:
b) zeros(4)

ans =

0 0 0 0
0 0 0 0
0 0 0 0
0 0 0 0

zeros(3,1)

ans =

0
0
0

Output:
N

N=

-5.0000 2.0000
3.0000 -1.0000

c) det(N)

ans =

-1.0000

Output:

d) linspace(1,20,20) ans =
Columns 1 through 12

1 2 3 4 5 6 7 8 9 10
11 12

Columns 13 through 20

13 14 15 16 17 18 19 20

Output:

e) logspace(10,10,5) ans

1.0e+10 *

1.0000 1.0000 1.0000 1.0000 1.0000

Output:

You might also like