MATLAB onramp Flashcards

(31 cards)

1
Q

State which key symbolises multiplication

A

*

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

State which key symbolises division

A

/

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

State what a semicolon means

A

A semi colon suppresses the output

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

State what pressing the up arrow does

A

Pressing the up arrow recalls previous commands

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

Describe how to name a matlab variable

A

A matlab variable must start with a letter and contain only letters, numbers and underscores

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

State how to clear all workspace variables

A

Type in the command “clear”

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

State how to clear the command window

A

Type in the command “clc”

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

State the matlab constant for π

A

pi

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

State the matlab function for absolute values

A

abs

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

State the matlab function for calculating eigenvalues

A

eig

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

State the matlab function for calculating square roots

A

sqrt

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

Describe an array

A

All matlab variables are called arrays - each variable can be more than one number.

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

Describe a scalar

A

A scalar is one number, ie a 1 by 1 array (1 row by 1 column)

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

Describe how to create arrays with multiple elements

A

Using square brackets, you can create arrays. Eg x = [3 5]

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

Describe how to create an array with elements in a single row (a row vector)

A

Separate the elements using a space or a comma

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

Describe how to create an array with elements in a single column (a column vector)

A

Separate the elements using a semicolon.

17
Q

Describe how to create a matrix

A

Enter the matrix row by row, separating the rows by semicolons

18
Q

Describe a short method of writing a row vector containing consecutive increasing integers

A

enter first:last (note you do not need square brackets)

19
Q

Describe a short method of writing a row vector containing integers of a particular spacing

A

enter first:spacing:last

20
Q

Describe how to enter a row vector of unknown spacing if you know the first and last numbers and the total number of columns

A

Using the linspace fucntion: linspace(first,last,number_of_elements) (note the use of commas)

21
Q

Describe how to transpose a row vector to a column vector

A

( ‘ ) is the transpose operator. You can either transpose x or transpose the parenthesis of a row vector

22
Q

Describe how to create a matrix of random numbers

A

Entering rand(a) where a will produce an a x a matrix of random numbers. Entering rand(a , b) will produce an a x b matrix of random numbers

23
Q

Describe how to create a zero matrix

A

Entering zeros(a) where a will produce an a x a matrix of zeroes. Entering rand(a , b) will produce an a x b matrix of zeroes

24
Q

Describe how to save a variable x to a given name

A

Enter “save foo x” to save variable x to a file called foo.mat

25
Describe how to load a saved variable of a given name
Enter "load foo" to load a file called foo.mat
26
Describe how to display the contents of of any variable
Enter the variable name
27
Describe how to extract values from an array
Using row,column indexing. Eg y = A(6,7) will give you the element in the 6th row and 7th column of matrix A and label it y
28
Describe the use of 'end'
'end' refers to the end value in a row or column. You can also use end-1 to refer to the second to last value, etc
29
Describe the colon operator ( : ) when used as an index
( : ) specifies all the elements in that dimension. Eg x = A(2,:) creates a row vector with all the elements from the second row of A. x=A(1:3,:) creates a matrix containing the first, second and third rows of matrix A
30
Describe a single index value
A single index value can be used to reference a single element. Eg x=v(3) refers the the 3rd element of v when v is either a row or a column vector
31
Describe a single range of index values
UP TO 5.2