lesson 2 Flashcards

1
Q

what is an array?

what are the numbers within an array called?

can rows have different numbers of elements?

A

any set of numbers arranged in a rectangular patten

elements of an array

no, each row must have the same number of elements as every other row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

what are matrices?

A

2d rectangular arrays made up of rows and columns

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

what do we call a 1d array?

what do we calla 2d array?

A

vector

matrix (plural - matrices)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

some functions in matlab:
how do you write square root…

sin…

what does size do

A

sqrt

sin but for degrees its sind

size tells you the ‘size of the array e.g for a matrix the row and element number

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

a custom among people using matlab is to use ____ for vector’s and _____ for matrices

A

lowercase, uppercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

what does 1:3:7 mean and what would it display

what does 1:7 do

A

create a row starting from 1 increasing in values of 3 going no higher the 7
it would display 1 4 7

displays 1 to 7 increasing by 1 going no higher then 7 (so basically just numbers 1 to 7)
it would display 1 2 3 4 5 6 7

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

you write ______ to access any specific part of matrices

if there is no element in the area you have asked for then what does MATLAB do?

your write _____ or _____to find multiple elements separated in different rows or columns

how do you access the last row/column of a matrix?

you can find the second last row/column by using _____

A

> > x(2,3)

adds in the missing data for the all elements in the row and column you asked for as 0

x(2,[3,5]) gives elements in row 2 column 3 and 5
x([2,1], 2) gives elements in row 2 and 1 from column 2

use the key word ‘end’
e.g
x(end,[3,5]) gives elements in end row column 3 and 5

end-1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what is the short hand 1:end

how would you use it?

A

:

x(1:end, 2) would become x(:, 2) and still show all rows available in column 2

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

how do you add the matrix [10 20; 30 40; 50 60] to 2nd and 3rd column of the matrix x (the matrix x is 3 by 5 here)

A

x(:,[2:3]) = [10 20; 30 40; 50;60]

not you have to use : I think cuz : means 2 to 3 witch 2,3 does not
also if the right side matrix does not fit perfectly into the left side matrix you cant use 1:end and need to explicitly say the rows needed
e.g 1:3 in this case

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

how to combine matrices?

for the matrices to add together the end product must form a ______.

A

write as in you creating a normal matrix
e.g
x = [A1;A2;A3]

rectangle

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

what is the transposition operator in MATLAB?

what does it do when applied to mtracies
e.g
» G = H’

A

it turned rows into columns and columns into rows
H = [1 2 3; 4 5 6] into G = [1 4; 2 5; 3 6]

formal definition - indices are swapped:
H’(m,n) = H(n,m) for all m and n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

matlab will always run _____ ____ ___ ______ before everything else

A

what’s inside the brackets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

when doing arithmetic operation with matrices the matrixes must _____

A

agree (same size) (or one of them is a scalar)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

what symbol do we use when multiplying arrays?

what symbol do we use when multiplying matrix?

what symbol do we use when dividing arrays?

what symbol do we use when dividing a matrix?

what symbol do we use for exponentials when doing operations with arrays and matrices?

A

.*

*

./

/

.^ and ^
(array and matrices operations are different (somehow idk how))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

array multiplication:
when can you use matrix multiplication?

this means that…

matrix multiplication works by…

and give an algebraic example

A

when matrix A has the same number of columns as matrix B has rows.

matrix multiplication is not reversible.
e.g
AB =/ BA

multiplying rows by columns.
multiplying every element in a row from matrix A by its corresponding element in a column from matrix B.
notes - you only multiply them 1 for 1 not 1 for many (same number from matrix A/B is not multiplied twice)
e.g
0 0 1
*
7 6 9
3 7 9
2 3 2
=2,3,2
as
07+03+12 = 2 …ect
0
6+07+13 = 3
09+07+1*2 = 2
=2,3,2
resulting in the dimensions of the new matrix consisting of the number of rows form matrix A and the number of columns form matrix B

A(n,m) * B(m,u) = Z(n,u) (Z consists of M from A * M from B)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly