
- Matlab Tutorial
- MATLAB - Home
- MATLAB - Overview
- MATLAB - Environment Setup
- MATLAB - Syntax
- MATLAB - Variables
- MATLAB - Commands
- MATLAB - M-Files
- MATLAB - Data Types
- MATLAB - Operators
- MATLAB - Decisions
- MATLAB - Loops
- MATLAB - Vectors
- MATLAB - Matrix
- MATLAB - Arrays
- MATLAB - Colon Notation
- MATLAB - Numbers
- MATLAB - Strings
- MATLAB - Functions
- MATLAB - Data Import
- MATLAB - Data Output
- MATLAB Advanced
- MATLAB - Plotting
- MATLAB - Graphics
- MATLAB - Algebra
- MATLAB - Calculus
- MATLAB - Differential
- MATLAB - Integration
- MATLAB - Polynomials
- MATLAB - Transforms
- MATLAB - GNU Octave
- MATLAB - Simulink
- MATLAB Useful Resources
- MATLAB - Quick Guide
- MATLAB - Useful Resources
- MATLAB - Discussion
MATLAB - Scalar Operations of Matrices
When you add, subtract, multiply or divide a matrix by a number, this is called the scalar operation.
Scalar operations produce a new matrix with same number of rows and columns with each element of the original matrix added to, subtracted from, multiplied by or divided by the number.
Example
Create a script file with the following code −
a = [ 10 12 23 ; 14 8 6; 27 8 9]; b = 2; c = a + b d = a - b e = a * b f = a / b
When you run the file, it displays the following result −
c = 12 14 25 16 10 8 29 10 11 d = 8 10 21 12 6 4 25 6 7 e = 20 24 46 28 16 12 54 16 18 f = 5.0000 6.0000 11.5000 7.0000 4.0000 3.0000 13.5000 4.0000 4.5000
matlab_matrics.htm
Advertisements