a b c d e 1 1 prepared by dr iyad jafar university of
play

a b c d e 1 1 Prepared by Dr. Iyad Jafar UNIVERSITY OF JORDAN - PDF document

UNIVERSITY OF JORDAN UNIVERSITY OF JORDAN COMP CO MPUTER ENGI UTER ENGINEERIN NEERING DEPARTM G DEPARTMENT NT CPE0907311 COMPUTER CPE0907311 COMPUTER APPLICATIONS LAB APPLICATIONS LAB EXERCISE SHEET 2 EXERC SE SHEET 2 STUDY THE S


  1. UNIVERSITY OF JORDAN UNIVERSITY OF JORDAN COMP CO MPUTER ENGI UTER ENGINEERIN NEERING DEPARTM G DEPARTMENT NT CPE0907311 COMPUTER CPE0907311 COMPUTER APPLICATIONS LAB APPLICATIONS LAB EXERCISE SHEET 2 EXERC SE SHEET 2 STUDY THE S STUD 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 0 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 columns. Part Command a b c d e 1 1 Prepared by Dr. Iyad Jafar

  2. UNIVERSITY OF JORDAN UNIVERSITY OF JORDAN CO COMP MPUTER ENGI UTER ENGINEERIN NEERING DEPARTM G DEPARTMENT NT CPE0907311 COMPUTER CPE0907311 COMPUTER APPLICATIONS LAB APPLICATIONS LAB EXERC EXERCISE SHEET 2 SE SHEET 2 3. Compute the length and magnitude of the following 3. Vector Length Magnitude [1.3 ,-5, 0.75] [1,-6,11,3.3] 4. 4. Write the commands required to construct a cell array that contains the following data. How can you extract the contents of the third element (1,3) in the (2,2) cell in this cell array. Computer Engineering Undergraduate program Graduate program Department ⎡ ⎤ 4 1 [ ] − ⎢ ⎥ 6 12 1 9 23 ⎣ ⎦ 9 11 Command(s) to create the cell array Command(s) to extract the required element 5. 5. For the data given in the table below, write the down the commands required to a. Create a MATLAB structure array called student_records. b. Modify the ID of the first record to 0056191. c. Delete the Height field from this structure array. Name ID Height Weight James Adam 009736111 172 80 Nicolas Alexander 239918711 189 93 Part Answer a 2 2 Prepared by Dr. Iyad Jafar

  3. UNIVERSITY OF JORDAN UNIVERSITY OF JORDAN COMP CO MPUTER ENGI UTER ENGINEERIN NEERING DEPARTM G DEPARTMENT NT CPE0907311 COMPUTER APPLICATIONS LAB CPE0907311 COMPUTER APPLICATIONS LAB EXERC EXERCISE SHEET 2 SE SHEET 2 b c 3 3 Prepared by Dr. Iyad Jafar

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend