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 ♯2

1. Redo all examples from class.

2. Create anonymous functions for the following math functions, where input argument(s) xor ycan be a

vector(use element-by-element operations).

(a) f(x) = ex2+1

pcos(x2+ 2)

(b) f(x, y) = 2x2−4xy +y3

Calculate f(x) given x= 2 and x= [1 2 3 4].

Calculate f(x, y) given x= 1, y = 2 and x= [1 2 3 4], y = [2 3 4 5].

3. Re-do Sales Example. Find out the most proﬁtable product and location.

4. 2-D plot. Plot the following functions in one ﬁgure window, add title and legend to graph.

f1(x) = 2x+ 1

f2(x) = x2−2

f3(x) = sin(2x−1), where x∈[−2π, 2π].

5. 3-D plot. Given function f(x, y) = x2+y−sin(xy), draw 3-D graph of contour, plot3, mesh, surface

on the intervals x∈[−2π, 2π] and y∈[−2π, 2π].

6. Add axis, legend and title to the graphs in question 3 and 4.

7. Re-do Temperature Example.

1

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

Unlock to view full version