Matlab: questions for beginners

download Matlab: questions for beginners

of 1

description

The questions help the reader become familiar to the basics of MATLAB when they are worked upon.

Transcript of Matlab: questions for beginners

Tutorial (Introduction to MATLAB)Nitin Padhiyar, IIT Gandhinagar

Vector Operation1. Create a column vector of the even whole numbers between 31 and 75. 2. Create 10 random numbers [0,1] and store them in a row vector a Find minimum, maximum, average, and standard deviation of a and store them in appropriate variables Use length command to find the number of elements in a

Matrix Operation3. Create two matrices, A and B, of size 3 x 4 with all their elements being uniformly distributed random numbers [0,1] Sum the two matrices, A and B Find AB and assign it to C Extract first three rows and three columns of A and B and assign them to D1 and D2, respectively Find the inverse of A and assign it to E Find the eigen values of D1 Find the rank of the matrix A Find the condition number of the matrix D1 Generate a matrix F of size 4 x 5 with all their elements being zero Generate a matrix G of size 4 x 5 with all their elements being one Replace the 3rd row and 2nd column element of A by 0 Replace the entire 2nd row B by 1 Use size command to find the size matrix (AB)

If Else Condition4. Generate two random matrices A and B of size 3 x 3 Compare the two matrices to find which elements of A are larger than the corresponding elements of B Generate a random number, x, and find y as follows Y=e-x if x < 0.5 Y=e-x/2 otherwise

For Loop 5. In problem 2, replace all the values of a less than 0.4 by 06. In problem 3, replace all the values of A less than 0.4 by 0

Plot7. Generate a vector, x, 0, 0.1, 0.2,, 1. Find y=e-x 8. Plot y Vs x. provide the two appropriate axis titles.

Writing a Function9. Write a function file to compute y=x3+x2+x-110. Compute the value of y at x= 0, 1, 1.5, -3, 100, 2.3, and 4

Note: Use help window for getting the help of any operation