Lecture12_Array_Operation

Tutorials:

1. Array has the following frequently used operators:

Array addition and subtraction are being conducted in 'element-wise' automatically.

Notes:
• Arrays must be of identical sizes.
• When a scalar (number) is added to an array, the number is added to all elements of the array.
• Subtraction is identical.
HOWEVER
Multiplication and Division are using different rules!!!!
For element-wise operation, you have to have a '.' before the operator!!
For example:

Also, built-in functions also work element-by-element, which means the function will apply to every element in the array at the same time.

However, when multiplying or dividing these functions, or when raising them to a power, you must use element-by-element operations if the arguments are arrays. For example, if x is a vector, then to compute z = sqrt(x) · sin(x), you must type: z = sqrt(x).*sin(x)

Please tell me what are the highlighted operations represent?

2. Array Functions
There are many array functions sum, mean, median, min, max, sort, std, etc.

3. Non-elementwise array (matrix) mutiplications:
What if you don't use '.' in multiplication and division

Two arrays (matrix) multiplication:

Another IMPORTANT thing: Matrix notatino can represent equations:

Now, let's take care of a 'serious' matrix:

IMPORTANT

End of the tutorial...

Now, starts the in-class tasks you need to submit, due Wed.

(Y = log(X) returns the natural logarithm ln(x) of each element in array X.)

No other homework other than these four in-class problems. Publish your results in one 'html' file and send it to homeworkflc02@gmail.com by Wed.