School

York UniversityDepartment

Information TechnologyCourse Code

ITEC 2600Professor

Xiaofeng ZhouStudy Guide

QuizThis

**preview**shows half of the first page. to view the full**1 pages of the document.**ITEC2600 in-Class Exercises X.Zhou York University

ITEC 2600

Introduction to Analytical Programming

Lab Exercise ♯3

1. Redo all examples from the lecture.

2. Random numbers(vector).

(a) Generate a 1-by-5 vector v1 and 5-by-1 vector v2 whose elements are random numbers.

(b) Generate a 6-by-10 matrix mat whose elements are random integers ranging from 1 to 99, using

built-in function rand and randi separately.

(c) Save work space to a MATLAB data ﬁle, then clear work space.

(d) Load the saved data ﬁle into work space, then display v1, v2 and mat.

3. Random numbers(matrix).

(a) Generate a 1000-by-10 matrix data whose elements are random numbers ranging from 20 to 100.

Save data to an ASCII data ﬁle and Excel data ﬁle, then clear data in the work space.

(b) Read the saved Excel data ﬁle to data.

(c) Find the maximum number in each row and each column of data. Find the minimum number in

each row and each column of data.

4. Modify your program in question 3 such that the random number generated can be repeatable.

5. Redo the ‘Grades’ example. Assign the grade letter to each student following the evaluation scheme of

https://calendars.students.yorku.ca/2016-2017/academic-and-ﬁnancial-information/academic-services/grades-

and-grading-schemes

–Read the student’s information into MATLAB using built-in function readmatrix.

–Re-Calculate the student’s ﬁnal mark by anonymous function.

–Calculate the percentage for each grade level, draw pie chart.

–Redo the ‘Grades’ example using switch.

1

###### You're Reading a Preview

Unlock to view full version