Week 5 ENCMP 100 Flashcards
What is a vector
A vector is a special case of a matrix in which one of the dimensions is 1
What does the ‘char’ function do?
the function char converts an integer to the character equivalent
What does size() do?
size returns the # of rows and columns for a vector or matrix
Rows x Columns
What is the default data type in MATLAB?
The default data type is double
What does ‘subplot’ do?
The subplot function creates a matrix (or vector) in a
Figure Window so that multiple plots can be viewed at
once
What data types are supported in MATLAB
Real numbers, Integers, Characters and Strings, Logical & Complex Numbers
Abs means what?
Absolute value
Function ‘complex’ creates what?
A complex array
Conj creates what
Complex conjungate
What does ‘i’ do?
It is a imaginary unit
What does ‘imag’ do?
It is the imaginary part of a complex number
What does the colon operator do?
Colon operator: iterates through values in the form first:step:last
e.g. 5:3:14 returns vector [5 8 11 14]
What does .* do?
It is an array multiplication operator
How do you do array division?
array division: A ./ B, A .\ B
How do you do array exponential
array exponentiation A .^ 2
What is matrix multiplication
In MATLAB, the multiplication operator * performs matrix
multiplication
In order to be able to multiply a matrix A by a matrix B, the number of
columns of A must be the same as the number of rows of B
If the matrix A has dimensions m x n, that means that matrix B must
have dimensions n x something; we’ll call it p
- In mathematical notation, [A]m x n [B]n x p
-We say that the inner dimensions must be the same
What is the difference between a matrix and array multi platoon
Confusing matrix multiplication and array multiplication. Array
operations, including multiplication, division, and exponentiation, are
performed term by term (so the arrays must have the same size); the
operators are .*, ./, .\, and .^. For matrix multiplication to be possible,
the inner dimensions must agree and the operator is *.
What is ASCII
standard ASCII has 128 characters; integer equivalents are 0-127
Is subplot row wise or columnwise
It is rowwise
What is Linear Indexing
Linear indexing: only using one index into a
matrix (MATLAB will unwind it column-by
column)
Note, this is not generally recommended
What can be used to determine the number of elements in a vector
Instead, use the function length or numel to
determine the number of elements in a vector, and the function size
for a matrix:
len = length(vec); [r, c] = size(mat);
What does the plot function do?
77
The ASCII codes for the letters a and d are 97 and 100, respectively. What are the values of v1 and s1, respectively?
v1 = ‘a’+3;
s1 = [‘a’ 100];
100 & ad
What is a sinusoid function?
https://dademuch.com/2020/10/07/the-sinusoidal-characteristics-in-discrete-time-matlab/