matlab lab exe

2
1. Write the MATLAB commands to define the following m 1 3 5 . . 0.0 0.2 0.4 ... 99 atrices. .6 9 MAT 9.8 10 2 4 LAB LA 6 B EXCERCISE a G b F 0.0 (i) A(1:2,3) (ii) A(3,:) 1 2 3 4 2.Given A= 5 6 7 8 run following MATLAB commands 2 3 (iii) A(:,3) (iv) A(1:2,1 1 4 1 2 4 2 2 3.Given A= 1 1 1 and B= 2 3 :4 1 ) 2 2 2 2 find 2 2 2 1 -1 4 4.Given X= 1 1 -2 run following MATLAB commands 2 4 1 (a)A>B (b) A*B (c)A' (d)A/2 (i) diag(X) (ii) triu(X) (iii)tril(X) 5.Draw the Graph of y= x e 2 over the 6.Draw the function over the . 7.Tabulate the function an interval -1.5 to 1.5 plot of sine interval -4 to 4 y=4sin3x u=3sin4 d for . 8.The area x x=0,0.1,0. A of a tri 2.. ang ......,0 le w .5 ith s ides of length a,b and c is given by . write a matlab function that will accept the values a,b and c as input s= a (a+b+ nd return the value of A as outp A= ( )( )( ) ut 2 . c)/ wher ss a s c e b s

Upload: krishna-mohbey

Post on 19-Jul-2015

21 views

Category:

Engineering


4 download

TRANSCRIPT

Page 1: Matlab lab exe

1. Write the MATLAB commands to define the following m

1 3 5.                       .       0.0 0.2 0.4 ... 99

atri

ces.  

  

.6 9

MAT

9.8 102 4

LAB LA

6

B

        

EXCERCISE

a G b F

0.0   

(i) A(1:2,3) (ii) A(3,:)

1 2 3 4

2.Given A= 5 6 7 8 run following MATLAB commands

2 3

(iii) A(:,3) (iv) A(1:2,1

1 4

1 2 4 2 2

3.Given A= 1 1 1 and B=

2 3

:4

1

)

2

2 2 2 find

2 2 2

1 -1 4

4.Given X= 1 1 -2 run following MATLAB commands

2 4 1

(a)A>B (b) A*B (c)A' (d)A/2

(i) diag(X) (ii) triu(X) (iii)tril(X)

5.Draw the Graph of y= xe

2

over the

6.Draw the function over the .

7.Tabulate the function an

interval -1.5 to 1.5

plot of sine interval -4 to 4

y=4sin3x u=3sin4d for .

8.The area

x x=0,0.1,0.

A of a tri

2..

ang

......,0

le w

.5

ith sides of length a,b and c is given by

. write a matlab function that will accept the values

a,b and c as input

s=

a

(a+b+

nd return the value of A as outp

A= ( )( )( )

ut

2

.

c)/wher

s s a s c

e

b s

Page 2: Matlab lab exe

2

2

1/3

9.Draw the plot of the functions

1 1

2 2 10.Given A= find

3 3

4

4 for

10

-6 2

f(x) for -2 2

( 6) for 2 6

(a)average (b) median (c)std

0

11. Display triangle a

xe x

x x

x x

s follow:(using loops)

12. Find the solution of the equation

1

2 3

4 5 6

7 8 9 10

s . by writing matlab function.

13. Input the salary

inx

pa

=2x-2

ckag

* >Rs 3,50,000 then 12% of total income

*

e of the different persons. The income Tax to be

Between Rs 3,50,000 and 2,50,000 then 10% of tot

paid

are as follows

al income

* B

etwee

if..el

.

Use state

n Rs 2,50,000 and

se funct

1,50,000 then 7% of tot

ment & to calculate the incom

al income

*

e tax to be paid by

Below Rs 1,50,000 then no

the

different persons.

14.W

t

r

ions

ax

ite a read and write da matlab program to from text ta file.

15. Given the following table of line and color options, write the MATLAB command to

generate a plot for x vs y1 as a dotted green line and x vs y2 as a dashed red line.

Line Type Indicator Color Indicator

dotted : green g

dashed -- red r