First Year Flashcards

1
Q

x = sum (y)

A

sums the vector y or will sum the values in each column

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

x = abs (y)

A

returns the absolute value of y

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

x = sign (y)

A

will create a random number

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

[max, ind] = max (y)

A

will return the maximum value of and the index. if it is a matrix the max value of each column will appear

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

For angles which convention is used?

A

Radians

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

format for a for loop

A

for variable = index_values
»code statement referencing index
» end

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

format for a while loop

A

> > while (expression)
statements
end

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

Break function

A

Jumps out of the loop

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

Continue Function

A

goes back to the start of the loop and executes the next iteration without running the remaining code

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

Return Function

A

Will return the currently running code

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

Which function takes precedence in and/or

A

and takes precedence so bracketing can be used to manually set the order

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

Indexing formats

A

CSV is zero
MATLAB is one index
DLM is one index

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

format for saving a text file

A

> > save (‘mydata.txt’, ‘-ascii’)

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

Load command format and use

A

> > load mydata.mat variable 1
where:
mydata is the filename
variable 1 is what wants to be retrieved

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

Whats the import wizard used for?

A

To import a variety of files including images

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

What is different for the format of how string values are coded

A

Curly brackets must be used

17
Q

format for a User Defined Function

A

> > function y = function name (x)
%comments describing what the function does
code for function

where
y is the output
x is the input argument/s
and the file name should be the same as the function name

18
Q

How to create a vector of length 10 starting at 2 with an increment value of 6

A

> > v = linespace (2,6,10)

19
Q

What does &raquo_space; if a>=b ¦ c ~= b mean in words

A

is a id bigger or equal to b or c is not equal to b

20
Q

Under which conditions do logical and relation operators return 1 and 0’s

A

when they are used outside for and while loops

21
Q

How do double operators work with scalars

A

in a&&b if a is false then b isn’t seen to

or a¦¦b if a is true b isn’t evaluated

22
Q

format for csv read

A

> > variable = csvread (‘file.csv’ R,C,[R1,C1,R2,C2])
R,C is the index of where the file wants to be read from
R2, C2 is where the read function wants to be ended

23
Q

Why are user defined functions used?

A

Portability
Readability
Reliability

24
Q

What does a red error bar mean?

A

it signifies an actual error, meaning the function will not run

25
Q

what is fprintf used for?

A

to write to a file or to the command window

26
Q

what is sprintf used for?

A

to create a string variable

27
Q

What cannot be called from the command window

A

sub functions as they are in a user defined function and do not have the same file name as the function meaning the command window cannot find them