Lab Task 1
Lab Task 1
Lab Task 1
Islamabad
ID: F22BSCIET031
DEPARTMENT: IET
Introduction to MATLAB
Task#01
Create vectors:
Part A
Part B
Task#02
Let x = [3 -2 0 5 1 9 5 6]
Part A
Part B
Part (C+D)
Task#03
Let x = [4 3 9 1] and y = [2 1 9 -3]
c. Multiply each element in x by the corresponding element in y and store the result in ‘c’.
Part A
Part B
Part C
Part D
Task#04
Given a vector t = [-3:0.2:2] write down the MATLAB expressions that will correctly compute
the following:
Part B
Part C
Task#05
Find a short MATLAB expression to build to matrix that is given in question
Task#06
Give a MATLAB expression that uses only a single matrix multiplication with Matrix B (obtained in
problem 5) to obtain:
Part A
Part B
Part C
Task#07
Given a matrix A, such that: Perform the following operations:
b. Extract the 1st and 3rd columns of matrix A and store them in matrix C.
c. Add the 1st and 3rd rows of matrix A together and store the result in vector D.
d. Change the value in the 2nd row and 3rd column of A to +7 (instead of -7) and call the result AA (do
not destroy/change the original A matrix).
e. Create a matrix that contains rows 1 and 3 from A, the second row of AA, and the result of part (c).
Part A
Part B
Part C
Part D
Part E