0% found this document useful (0 votes)
19 views

Lab1

DSP Lab 1

Uploaded by

mujtabajamal2004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views

Lab1

DSP Lab 1

Uploaded by

mujtabajamal2004
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

MATLAB Command Window Page 1

>> A = 5*ones (3, 3)

A =

5 5 5
5 5 5
5 5 5

>> B = rand (2, 4)

B =

0.8147 0.1270 0.6324 0.2785


0.9058 0.9134 0.0975 0.5469

>> x=3*cos(pi/3)

x =

1.5000

>> y=4*sin (pi/6)

y =

2.0000

>> x=3*cosd (pi/3)

x =

2.9995

>> y=4*sind (pi/6)

y =

0.0366

>> u= [8 -11 10]


v= [10 ; -21 ; -52]
w= [2 1 3]

u =

8 -11 10

v =

10
MATLAB Command Window Page 2

-21
-52

w =

2 1 3

>> u*v

ans =

-209

>> u*w
Error using *
Inner matrix dimensions must agree.

>>
>> u*w'

ans =

35

>> u*u'

ans =

285

>> u = [1 2 3; 4 5 6; 7 8 9];
w = [9 8 7; 6 5 4; 3 2 1];
>> u*w

ans =

30 24 18
84 69 54
138 114 90

>> u.*w

ans =

9 16 21
24 25 24
21 16 9

>> A=[ 1 2 5; 8 6 1; 5 2 9]
MATLAB Command Window Page 3

A =

1 2 5
8 6 1
5 2 9

>> A(:,:)

ans =

1 2 5
8 6 1
5 2 9

>> A(:,1)

ans =

1
8
5

>> A(2,:)

ans =

8 6 1

>> A(2:3,2:3)

ans =

6 1
2 9

>> A(:,2)

ans =

2
6
2

>>

You might also like