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

matlab ex-2

The document presents a series of mathematical operations and logical comparisons performed in a programming environment. It includes examples of addition, subtraction, multiplication, division, and power functions, along with logical operations such as equality and inequality checks. The results of each operation are displayed, demonstrating the functionality of the programming language used.

Uploaded by

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

matlab ex-2

The document presents a series of mathematical operations and logical comparisons performed in a programming environment. It includes examples of addition, subtraction, multiplication, division, and power functions, along with logical operations such as equality and inequality checks. The results of each operation are displayed, demonstrating the functionality of the programming language used.

Uploaded by

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

EXPERIMENT-2

OUTPUT

>> plus(3,6)

ans =

>> uplus(5)

ans =

>> uplus(-5)

ans =

-5

>> minus(3,2)

ans =

>> uminus(5

ans =

-5

>> uminus(-5)

ans =

>> times(3,4)

ans =

12

>> a=[ 2 3 4 5 ]
a=

2 3 4 5

>> b=[ 4 5 6 7 ]

b=

4 5 6 7

>> d =a.^ * b

d=

8 15 24 35

>> c = 3

c=

>> e = 5

e=

>> f =c^ * e

f=

15

>> g = 2

g=

>> h = 4

h=

4
>> i = g / h

i=

0.5000

>> j=[456]

j=

4 5 6

>> k = [ 1, 2, 3 ]

k=

1 2 3

>> l =j./k

I=

4.0000 2.5000 2.0000

>> m =j. \k

m=

0.2500 0.4000 0.5000

>>>> a =[2 3;2 3]

a=

2 3

2 3

>> b = 2

b=

>> mpower(a,b)

ans =
10 15

10 15

>>c=[ 2 3 4 5]

c=
2 3 4 5

>> d = 3

d=

>> power(c,d)

ans =

8 27 64 125

>> e = 5

e=

>> f = 2

f=

>>power (e, f)

ans =

25

>> g =[ 3 4 5 6 ]

g=

3 4 5 6
>> h = [ 1 2 3 4 ]

h=
1 2 3 4

>> i =g./h

i=

3.0000 2.0000 1.6667 1.5000

>> rdivide (g, h)

ans =

3.0000 2.0000 1.6667 1.5000

>> j =g.\h

j=

0.3333 0.5000 0.6000 0.6667

>> Idivide (g, h)

ans =

0.3333 0.5000 0.6000 0.6667

>> k =[ 2 3 4;1 2 3;4 5 2 ]

k=

2 3 4

1 2 3

4 5 2
>> ctranspose(k)

ans =

2 1 4

3 2 5

4 3 2

LOGICAL OPERATIONS

>> l=2

l=

>> 1==2

ans =

logical

>> m=5

m=

>> m==2

ans =

logical

>> 2>3

ans =

Logical
0

>> 3 > 2

ans =

logical

>> 2 < 3

ans =

logical

>> 3 < 2

ans =

logical

>> 2 ~= 3

ans =

logical

>> 3~=3

ans =

logical

>> 2 <= 2

ans =
logical

>> 1 <= 2

ans =

logical

>> 3<=2

ans =

logical

>> 4>=1

ans =

logical

>>4>=4

ans =

logical

>>4>=10

ans =

logical

>>

You might also like