BME201

0.0(0)
studied byStudied by 0 people
0.0(0)
full-widthCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/82

flashcard set

Earn XP

Description and Tags

Final Exam

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

83 Terms

1
New cards

what is a scalar

single number

2
New cards

what is a character

letter or number

3
New cards

what is an array

multiple scalars

4
New cards

what is a string using ‘ ‘

character array

5
New cards

what is a string using “ “

string

6
New cards

what are the two requirements for variable names?

clear/descriptive, succinct

7
New cards

create a custom function heading

function[outputs] = FunName(inputs)

8
New cards

create an anonymous function

FunName = @(inputs) code

9
New cards

if an input needs to be a character/string what needs to be before the closing parenthesis

‘s’

10
New cards

what is fprintf %f

float

11
New cards

what is fprintf %i

integer

12
New cards

what is fprintf %c

character

13
New cards

what is fprintf %s

string

14
New cards

what is fprintf %e

scientific notation

15
New cards

what is \t for

indent(4 spaces)

16
New cards

what is \n for

new line

17
New cards

brute force defining rows for 1D array

[1 2 3 4];

18
New cards

brute force defining columns for 1D array

[1;2;3;4]; (or [1 2 3 4]’;)

19
New cards

colon operator for rows in 1D array

row = start:step size:stop

20
New cards

how does linspace work

row = linspace(start, stop, total elements)

21
New cards

index x to get all odd elements

x(1:2:end)

22
New cards

index x to get all even elements

x(2:2:end)

23
New cards

to multiply or divide scalar and vectors what is needed

.* or ./

24
New cards

what does the size function return

[rows, columns]

25
New cards

what does the length function return

longest dimension

26
New cards

what does numel return

number of elements

27
New cards

change the 3rd element of array x to 10

x(3) = 10;

28
New cards

what would be the output when x = [1 2 3] and then x(end + 2) = 5

[1 2 3 0 5];

29
New cards

how would you reverse the order of array x

x = x(end:1:-1); (or x = flip(x))

30
New cards

what does mod(a, b) return?

remainder of a/b

31
New cards

when and how does && work

only works with scalars and if 1 is false don’t evaluate 2

32
New cards

when to use for loops

number of reps is known

33
New cards

when to use while loops

number of reps is unknown but we have a stopping condition

34
New cards

how does a for loop start

for k = 1:length(x)

35
New cards

how does a while loop start

while condition true

36
New cards

write out euler method

yes

37
New cards

which direction do the rows count up in a 2D array

-y

38
New cards

which direction do the columns count up in a 2D array

+x

39
New cards

what does x(:, 2) produce in a 2D array

all rows, 2nd column

40
New cards

what does x(3, :) produce in a 2D array

3rd row, all columns

41
New cards

brute force create x, a 2D array with 123 as the top row and 456 as the bottom row

x = [1 2 3; 4 5 6];

42
New cards

store spreadsheet (FileName.ext) data into variable data

data = readmatrix(‘FileName.ext’)

43
New cards

create spreadsheet (named filenameNew.ext) using dataNew

writematrix(dataNew, ‘filenameNew.ext’)

44
New cards

create a text file (filename.dat) using fprintf

fid = fopen(‘filename.dat’, ‘w’)

fprintf(fid, ‘…’)

fclose(fid)

45
New cards

Create vector P using polyfit

P = polyfit(x, y, N)

46
New cards

What is the N in polyfit(x, y, N)

highest exponent in the polynomial

47
New cards

use sum function to sum along the columns of array x

[1 2 3]

sum(x, 1)

48
New cards

use sum function to sum along the rows of array x

[1

2]

sum(x, 2)

49
New cards

how does the max function work ** dim is either 1 for columns or 2 for rows

[max values, index/location] = max(data, [ ], dim)

50
New cards

how can you find the global max of x and store it in variable y

y = max(max(x));

51
New cards

take the average of x

mean(x)

52
New cards

store the standard deviation of x in the variable y *rms works the same way

y = std(x, dim)

53
New cards

create a scatter plot using plot

plot(x, y, ‘shape’)

54
New cards

create a scatter plot using scatter

scatter(x, y, marker size, ‘options’)

55
New cards

create a histogram with m sized bins

histogram(x, m)

56
New cards

create a box plot

boxplot(x)

57
New cards

create a bar graph with error bars

bar(x, y)

hold on

errorbar(x, y, error bar size, ‘options’)

hold off

58
New cards

how does machine learning work?

pattern recognition

59
New cards

how does fitctree work?

based on decision trees, binary choices

60
New cards

how does fitcnet work?

creates neural network, how your brain works, better for complicated systems

61
New cards

what does a confusion matrix show?

predictions and actual results in a grid

62
New cards

import image (img.ext) into variable img

img = imread(‘img.ext’)

63
New cards

display image (img)

imshow(img)

64
New cards

save image (imgNew) as filename.ext

imwrite(imgNew, ‘filename.ext’)

65
New cards

convert rgb image (img) to grayscale (imgGray)

imgGray = rgb2gray(img);

66
New cards

convert rgb image (img) to binary image (imgBin)

imgBin = im2bw(img, fraction)

67
New cards

crop image (img) and store in variable imgCrop

imgCrop = imcrop(img[xTopLeft, yTopLeft, xSize, ySize])

68
New cards

color thresholding for red from image (img)

red = img(:, :, 1)

69
New cards

color thresholding for green from image (img)

green = img(:, :, 2)

70
New cards

color thresholding for blue from image (img)

blue = img(:, :, 3)

71
New cards

info for diff functions

1D arrays, easy to do N derivatives, loses data points for each derivative

72
New cards

info for gradient function

2D arrays, harder to do N derivatives, handles nonconstant step sizes, may have weird endpoints

73
New cards

take the 2nd derivative of y using diff function

diff(y, 2)

74
New cards

take the first derivative of y using gradient, store in v with t as the spacing for dimensions

v = gradient(y, t)

75
New cards

take the integral using the trapezoid rule and store it in yInt

yInt = trapz(x, y) + initial value

76
New cards

how does a 3D plot function work

plot3(x, y, z, ‘options’)

77
New cards

how does the mesh function work for 3D plots

mesh(X, Y, Z), colors along grid, white between grid

78
New cards

how does the surf function work for 3D plots

surf(X, Y, Z), color between the grid, black grid lines

79
New cards

how does the colorbar function fit into the title label when making a graph

title(colorbar, ‘title’)

80
New cards

how does the quiver plot work?

quiver(X, Y, U, V, scale for vectors)

81
New cards

how does streamslice plot work?

streamslice(X, Y, U, V, number of streamlines)

82
New cards

what is the difference between quiver and streamslice plots?

quiver looks like a vector field, streamslice has the lines connected

83
New cards

what are the U and V in the streamslice and mesh functions?

x and y vector magnitudes

Explore top flashcards