Study Guides (390,000)
CA (150,000)
York (10,000)
ITEC (100)
Quiz

ITEC 2600 Study Guide - Quiz Guide: Row And Column Vectors, Matlab, Exclusive OrExam


Department
Information Technology
Course Code
ITEC 2600
Professor
Xiaofeng Zhou
Study Guide
Quiz

This preview shows half of the first page. to view the full 3 pages of the document.
ITEC2600 in-Class Exercises X.Zhou York University
ITEC 2600
Introduction to Analytical Programming
Lab Exercise 1
1. Explain what the following MATLAB commands produce, then excute the following expressions in
MATLAB command window.
(a) (3 4) 2
(b) cos(pi)
(c) y= 10 5
(d) x= 5
(e) exp(x)
2. Define variables a, b, c and das a= 15, b = 4, c = (3 ×a)/b, and d=a×b×c
b+c, then evaluate the
followings in MATLAB command window. (Note: the followings are mathematical expressions).
(a) b×d
a×(c+d)×eb+c
d×log2(a)cos(d×c) + ab
(b) a3+c2
dc+ln(|a+bcd|)
(c) c×d×π(a+b)2
log10 (a×c)
3. Think about what results would be of the following expressions, and then type them in MATLAB to
verify your answers.
3 == 5 + 2
'b'<'a'+ 1
10 >5+2
(10 >5) + 2
'c'== 'd'- 1 && 2 <4
'c'== 'd'- 1 || 2>4
xor('c'== 'd'- 1, 2 >4)
xor('c'== 'd'- 1, 2 <4)
10 >5>2
4. Create a row vector vec start from -10 to 10, by incremental 5, using colon operator. The do the
followings:
(a) Create a new vector sub vec by extract the last 3 elements of vector vec.
(b) Change the value of last element of vec such that the value of last element is the function sin of
itself.
1
You're Reading a Preview

Unlock to view full version