SLIDE 1
CPE0907311 COMPUTER CPE0907311 COMPUTER APPLICATIONS LAB APPLICATIONS LAB EXERC EXERCISE SHEET 2 SE SHEET 2
1 1
UNIVERSITY OF JORDAN UNIVERSITY OF JORDAN CO COMP MPUTER ENGI UTER ENGINEERIN NEERING DEPARTM G DEPARTMENT NT STUD STUDY THE S Y THE SLIDES O IDES OF EXPERI EXPERIMENT 2 MENT 2 AND SOLV AND SOLVE THE FO E THE FOLLOW LLOWING ING PROB PROBLEMS LEMS BEFORE COMING TO THE LAB. BEFORE COMING TO THE LAB.
1.
- 1. It is required to generate the following vectors in Matlab:
- a. V1 is a vector that has 100 regularly spaced values starting at -5 and ending at 25.
- b. V2 is a vector that has 45 regularly spaced values starting at 20 and ending at 28.
Write down the required commands. Use two methods in each case and verify your answer. Method Commands 1 2
2.
- 2. Enter the matrix given below in Matlab then write the command(s) required to perform the
following
3.1 5 11 7 12 5 2.5 A = 102 3 4 4.2 1 6.45 8 11 − ⎡ ⎤ ⎢ ⎥ − ⎢ ⎥ ⎢ ⎥ − ⎢ ⎥ ⎣ ⎦
- a. Change the elements in the third column to [1;2;3;4].
- b. Change the all the elements in the second and third rows to
[2, 2, 5, 4;-9, -5, 14, 21]’
- c. Create a 2x4 array B consisting of all elements in the first and second rows.
- d. Create a 3x4 array C consisting of all elements from the second through the fourth
rows.
- e. Create a 2x2 array D from the second and third rows and the first and second