Exam 2: Review Flashcards

1
Q

Determine the best fit cubic function through ordered pairs (y,z); display the constant term of the function

A

[p, s] = polyfit(y,z,3)

disp(p(4))

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

Create a Cartesian plot of ordered pairs (x,y) in the upper right quadrant of figure number 66.

A

figure(66)
subplot(2,2,2)
plot(x,y)

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

Place a message on the plot at coordinates (5,10) that displays the value of a numeric array, CLmax

A

text(5,10, num2str(CLmax))

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

loglog(g,d,’–gd’)

A

plot of d as a function of g, both axis logarithmically, scaled dashed green line with green diamond data markers

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

data = data(find(data~=0))

A

removes zeros from the data array

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

z = uiputfile(‘*.bmp’,’Save data’)

A

z is the user selected location to save .bmp image. A command window will appear and allows the user to select where they wish to save the .bmp file

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

set(gca,’YDir’, ‘Reverse’)

A

gca = get current axis

reverse direction of the y axis for the current set of axes

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

command that would plot data in teh straightest alignment and include a dotted red line with res squares.

A

semilogy(x,y,’:rs’)

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

List the three basic construsts of “structured programming” common to all programming languages

A
  1. sequential
  2. conditional
  3. iterative
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

When do you use a for loop?

A

Use a for loop when you know how many cycles the loop will need to complete, but not the final result.

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

When do you use a while loop?

A

when you know the final condition but not how many cycles it will take.

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

What is the difference between curvefit and spline?

A

Spine goes through every data point,

Curvefit does not

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

List four basic mathematical functions we used for modeling data

A
  1. exponential
  2. Logarithmic
  3. Linear
  4. Power
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is the forward difference?

A

(y_i+1 - y_i)/(x_i+1 - x_i)

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

What is the backward difference?

A

(y_i - y_i-1)/(x_i - x_i-1)

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

What is the central difference?

A

(y_i+1 - y_i-1)/(x_i+1 - x_i-1)

17
Q

What does it mean for a numerical method to be O(h^2)?

A

absolute error is proportionate to h^2 so if we have h the error drops to (1/2)^2 = 1/4

18
Q

What is the criterion that makes a generalized curvefit equation a “best fit” model for the data?

A

for a best curve fit model, the R^2 value needs to be closest to 1 as possibl;e

19
Q

Explain the criteria for using a for loop and a while loop?

A
"for" = known number of iterations, unconditional
"while" = conditional, unknown number of iterations, performs expression until the logical expression is false
20
Q

Explain the effects numerical integration and differentiation have on the propagation of uncertainty in data.

A

integration - attenuates uncertainty (lowers)

differentiation - increases uncertainty (amplifies)

21
Q

Determine the definite integral of a function where the array f contains values of the dependent variable and hte array t contains values of hte independent variable

A

p = trapz(t,f)

22
Q

Determine the derivative dp of a polynomial where the array p contains the coefficients of the polynomial arranged in descending powers

A

dp = polyder(p)

23
Q

Assume that a plot already exists in the current figure window and its aces are in polar coordinates To this plot, add another data series of the variables theta and r and plot it with red circles and a dashed line

A

hold on

polar(theta,r,’–or’)

24
Q

Plot hte variable principal as a function of the variable time on a plot with linear scaling on the x axis and logarithmic scaling on the y axis. Locate this plot in the lower right hand quadrant of the figure window

A

subplot(2,2,4)

semilogy(time,principal)

25
Q

Use teh cursor to paste a comment on the current figure that displays the value of hte variable earnings. Indicate in this comment that earnings is calculated at year’s end and that the units are in dollars.

A

comment=[‘year end earnings,’ num2str(earnings)]

gtext(comment)