11 upvote00 downvotes

29 views4 pagesSep 24, 2011

© Attribution Non-Commercial (BY-NC)

DOC, PDF, TXT or read online from Scribd

Attribution Non-Commercial (BY-NC)

29 views

11 upvote00 downvotes

Attribution Non-Commercial (BY-NC)

You are on page 1of 4

Q.1. Create a symmetric matrix m with five rows and five columns. Calculate its

transpose and verify that the matrix is symmetric by observing that m=m.

Solution:

m=

5

1

2

3

7

1

2

3

7

3

2

3

7

3

2

3

7

3

2

1

7

3

2

1

5

>> m'

ans =

5

1

2

3

7

1

2

3

7

3

2

3

7

3

2

3

7

3

2

1

7

3

2

1

5

>> a=m-m'

%m=m

%m-m=0

a=

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

0

Q.2. Create a random matrix with 3 rows and 5 columns. The matrix values should

be integer b/w (0100), than change its all 2 rows values by 7.

Solution:

a=randint(3,5,[0,100])

a=

65

82

66

34

29

34

53

73

31

84

57

37

70

55

44

a(1:2,1:5)=7

a=

7

7

61

7

7

76

7

7

82

7

7

79

7

7

17

and also cascade more than one vector to form a matrix try to

make a matrix with the following properties.

(1) Matrix should contain 2 rows.

(2) First row of matrix should contain even number b/w (010)

(3) Second row of matrix should contain odd number b/w (11

20)

Solution:

b=

2

10

>> c=[11:2:20]

c=

11

13

15

17

19

8

17

10

19

>> mat=[b ; c]

mat =

2

11

4

13

6

15

calculate

(a) c=d+e

(b) (b) c=d-e

(c) (c) c=d*e

(d) (d) c=d/e

(e) Note: multiplication and division should be done element

by element.

Solution:

clc

clear all

close all

d= [1+2j 3 ; 7

d=

% clears desktop

% Removes all variables and functions

% Closes all the open windows

5j ]

1.0000 + 2.0000i

7.0000

e=

2.0000 + 3.0000i

0

3.0000

0 + 5.0000i

5.0000 + 5.0000i

1.0000 - 8.0000i

c=d+e

c=

3.0000 + 5.0000i

7.0000

8.0000 + 5.0000i

1.0000 - 3.0000i

(b) c = d-e

d= [1+2j 3 ; 7

d=

5j ]

1.0000 + 2.0000i

3.0000

7.0000

0 + 5.0000i

e=

2.0000 + 3.0000i

0

c=

-1.0000 - 1.0000i

7.0000

5.0000 + 5.0000i

1.0000 - 8.0000i

c=d+e

(c) c=d*e

d= [1+2j 3 ; 7

5j ]

-2.0000 - 5.0000i

-1.0000 +13.0000i

d=

1.0000 + 2.0000i

7.0000

3.0000

0 + 5.0000i

e=

2.0000 + 3.0000i

0

5.0000 + 5.0000i

1.0000 - 8.0000i

c=

-4.0000 + 7.0000i

0

15.0000 +15.0000i

40.0000 + 5.0000i

c=d*e

(d) c=d/e

d= [1+2j 3 ; 7

d=

5j ]

1.0000 + 2.0000i

7.0000

e=

c=d/e

c=

3.0000

0 + 5.0000i

2.0000 + 3.0000i

0

5.0000 + 5.0000i

1.0000 - 8.0000i

0.6154 + 0.0769i

0.3000 - 0.3000i

Inf

-0.6154 + 0.0769i

y=3*exp (3*pi*t);

Choose t from (0---150) with increment of 0.001

Solution:

clc

clear all

close all

t=0:0.001:150

y=3*exp(3*pi*t)

plot (t,y)

xlabel (time')

grid on

% clears desktop

% Removes all variables and functions

% Closes all the open windows

% Time for given function will be

% Generating the function

% plotting the signal

% Labeling the X-axis

ylabel ('Amplitude')

% Labeling the Y-axis

% start grid On

## Much more than documents.

Discover everything Scribd has to offer, including books and audiobooks from major publishers.

Cancel anytime.