CSE 7 Lecture Notes - Lecture 15: Scalar Multiplication, Programming Style

33 views3 pages

Document Summary

Cse 7 lecture 15 & 16 : 2 / 24-27 /17. Scalar multiplication: multiply every element by a scalar. Scalar addition: add a scalar to every element. Array operations on 2 matrices a and b: addition/subtraction: applied element by element, matrices must have same dimensions. >>im=imread( rainbow. jpg") g=im(:,:,2); result= g> 200 this is a logical data type. Isequal( ) function isequal(v1, v2) if equal returns one, if false then 0: >> v1= 1:4, >>v2= [1 0 3 4] >> isequal(v1, v2) ans= 0: >> v1 = = v2 ans= 1 0 1 1, >> all(v1==v2) ans=0. Array operations on two arrays a and b. Using relational operators on a vector or a matrix results in a logical vector or matrix. Use this to index into a vector or a matrix: only if index vector is type logical, >> vec= [44 3 2 9 11 6]

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents