Assignment 02 - University of California, Berkeley Fall...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
University of California, Berkeley Department of Mechanical Engineering Fall Semester 2008 Instructors: M. Frenklach, R. . Horowitz E7, Assignment 2 Assigned: Thursday, September 11 2008 Due: 12:00pm, Friday, September 19, 2008. This assignment is an introduction to using arrays, which are the basic building blocks in MATLAB . The ability to represent and handle multiple items in single collections is one of the main strengths of MATLAB and it is what makes code-writing very short. As in the previous assignment, turn in the hard copy of your published file to the drop boxes in Etcheverry 1109 and upload the soft copy of your script (the m-file) to Bspace. Do not forget to name your m-file as lastname_firstname_SID_lab02.m Useful MATLAB commands * in this assignment: linspace, length, sort, find, upper, lower, double, char, rem, size, max, min, plot, polyder, polyval, roots, conv, poly 1. Using linspace , create the row vector a having 9 regularly spaced elements starting with 16 and ending with 48. Then, using the colon notation and transpose, create the column vector b having a regular spacing of 0.5, starting with 0.5 and ending with 4.5. Do the following tasks by using the appropriate array operations. i. Divide each element of a by 2. ii. Add 1 to each element of b . iii. Take the third power of each element of a . iv. Divide all elements of a by the corresponding element in b (e.g. element by element division). v. Find the number of elements of a using the MATLAB function length. vi. Assign the 5 th element of a to a new variable c . vii. Create a row vector d which is composed of the 6 th , 4 th , 2 nd and 5 th elements of a . (e.g. the 1 st element of d is the 6 th element of a .) viii. Using the function sort , define the row vector d_sorted that contains the * Please refer to MATLAB help to learn how to use the functions introduced in this assignment. Assignment 2 E7 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
University of California, Berkeley Department of Mechanical Engineering Fall Semester 2008 Instructors: M. Frenklach, R. . Horowitz elements of d in ascending order.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/01/2009 for the course ENGLISH 7 taught by Professor Sengupta during the Spring '09 term at University of California, Berkeley.

Page1 / 7

Assignment 02 - University of California, Berkeley Fall...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online