Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Upcoming SlideShare
Loading in …5
×

# Lecture6

1,157 views

Published on

Published in: Engineering
• Full Name
Comment goes here.

Are you sure you want to Yes No
Your message goes here
• Be the first to comment

### Lecture6

1. 1. Lecture 6 Array operations Eng. Mohamed Awni Electrical & Computer Engineering Dept.
2. 2. Agenda 2 Addition & Subtraction.  Multiplication & Exponentiation  Element by Element operations Relational Operators  Exercise Homework Tiny Project
3. 3. Addition & subtraction Addition Subtraction
4. 4. Addition & subtraction Matrix addition & subtraction properties:
5. 5. If A and B are two matrices, the operation A*B can be carried out only if the number of columns in matrix A is equal to the number of rows in matrix B. Multiplication
6. 6. Multiplication
7. 7. Multiplication
8. 8. Multiplication
9. 9. ≠ Multiplication
10. 10. A matrix product properties: Multiplication
11. 11. Element-by- element operations • Carried out on each of the elements of the array • Only carried out on arrays of the same size • Only applied on multiplication, division, and exponentiation
12. 12. Element-by- element operations Importance of the element-by element calculations Calculate the corresponding y for each value of x The variable x is represented as a vector with elements -1, -0.5, 0, 0.5, 1 The elements of the vector y corresponding to the elements of the vector x are calculated in one step using element-by element operations
13. 13. Element-by- element operations
14. 14. Example Use of the element-by-element calculations, where it is required to get the corresponding values of
15. 15. Relational Operators Relational operators Produce logical values (true OR false) (One or zero) >> 5>2 ans = 1 >> 5<4 ans = 0 >> 1.5<=1.5 ans = 1 >> 2>=pi ans = 0 ans = 0 >> 1.8==1.801
16. 16. When relational operators are used on arrays, the relational operator is applied element-by-element and produces a logical array with the same dimensions as the original operands Relational Operators
17. 17. 1 7 Exercises
18. 18. Homework