You are on page 1of 2

Lab # 01

Familiarize with the Matlab environment and running some basic Matlab commands in Matlab. Lab Work:
Generate a 6X6 Matrix. Generate a 6X1 Matrix Generate a 3X4 Matrix Answer the following questions for the matrix shown below. 1.1 0.0 0.0 1.1 1.1 0.1 r.no 5.1 2.1 -3.5 -6.6 2.8 0.3 -0.4 0.0 1.1 6.0 r.no 1.3 r.no

(a) (b) (c) (d)

what is the size of the matrix? What is the value of the matrix (4,1)? What is the size and value of matrix ( : , 1 : 2 )? What is the size and Value of the (matrix [1 3],end)?

Determine the size and contents of the follwings arrays. Note that the later arrays may depend on the definition of arrays defined earlier in this exercise a) b) c) d) e) f) a=1:2:5 b=[a a a] c=b(1:2:3,1:2:3); d=a+b(2,:); w=[zeros(1,3) ones(3,1) 3:5] b([1 3],2 )=b([3 1],2);

Assume that value has been initialized to (r.no)*pi and determine what is printed out by each of the following statements: (a) disp([value=num2str(value)]); (b) disp([value=int2str(value)]); (c) fprintf(value=%e\n,value); (d) fprintf(value=%f\n,value); Evaluate the following expressions (a) r.no /5+6 (b) (r.no/5)+6

(c) (d) (e) (f) (g) (h) (i)

r.no /(5+6) r.no ^2^3 (r.no ^2)^3 r.no ^(2^3) round(-11/5)+6 ceil(-11/5)+6 floor(-11/5)+6

Note: r.no is your class roll No. programming should be done in M-File submit the report in hard form. Email me the M-file for this lab work.

You might also like