This preview shows page 1. Sign up to view the full content.
Unformatted text preview: er:'); The user can enter a number or an array in brackets If you need to get a string then val = input(`Enter a string:', `s'); Scalar Operations
The following operations are defined between two scalars: Addition Subtraction Multiplication Division Exponentiation a+b ab a*b a/b a^b 3 Scalar / Array Operations
The same operations may be performed between an array and a scalar. In this case the operation is performed to every element of the array. Array vs. Matrix operations
When two arrays are being operated on MATLAB makes a distinction between array an matrix operations. Matrix operations are the standard Linear Algebra operations Array operations are done on an element-byelement-byelement basis Array vs. Matrix operations
Array or Matrix operations (no difference)
Addition Subtraction Multiplication Right Division Left Division Exponentiation a+b ab a .* b a ./ b a .\ b .\ a .^ b Array vs. Matrix operations
Multiplication Right Division Left Division a*b a/b b\a Array (Element-by-element) operations (Element-by- Multiplication does standard matrix multiplication. The columns of a must equal the r...
View Full Document
- Spring '07