E7_Lecture4_Su10+posted

E7_Lecture4_Su10+posted - Vector addition (and subtraction)...

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

View Full Document Right Arrow Icon
E7 L3 1 If A and B are arrays of the same size , A + B is the array: A(i) + B(i) Example: Vector addition (and subtraction) Vector addition (and subtraction) >> A + B ans = -1 3 >> A - B ans = -5 1 >> A = [-3 2]; >> B = [2 1]; 3 2 1 - + = - 2 1 3 + =
Background image of page 1

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

View Full DocumentRight Arrow Icon
E7 L3 2 Vector – scalar addition (and subtraction) Vector – scalar addition (and subtraction) If A is an arra y, and b is a scalar A + b = b + A is the same size as A : A(i)+ b Example: >> A + b ans = -1 4 >> A - b ans = -5 0 >> A = [-3 2]; >> b = 2; 3 2 1 - + = - 2 2 4 + =
Background image of page 2
E7 L3 3 If A and B are arrays of the same size , A .* B = B .* A is the array: A(i) * B(i) Example: Array Array Element-by-Element Element-by-Element Multiplication Multiplication .* .* >> A .* B ans = -6 2 >> B .* B ans = 4 1 >> A = [-3 2]; >> B = [2 1]; 3 2 6 - × = - 2 1 2 × =
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Scalar-Array Multiplication Scalar-Array Multiplication If A is an arra y, and b is a scalar A .* b = b .* A the same size as A : A(i)* b
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 16

E7_Lecture4_Su10+posted - Vector addition (and subtraction)...

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

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