Lectures 12-16 Flashcards
ODE 45
applies a variable-step classical Runge-Kutta method that is h^4 accurate. Should be the first method to try
ode23
used for solving moderatley “stiff” equations (example - mass spring dampening with a high spring constant)
ode15s
should be used for solving stiff equations - potentially less acccurate
What is the set up for an ode
[x,y]=ode45(‘myfunc’,tspan,y1)
y1 = initial value
tspan = vector limiting the domain for the problem (need to define)(vector)
What are some causes of not being a linear equation?
squared term
two variables multiplied together
What are the three possible outcomes when solving a linear equation?
- there is a unique solution
- there is a non-unique solution (family of solutions)
- there is no explicit solution
What are the commands do to A^-1 of the equation Ax=b?
x=inv(A)*b
x=A\b
What does a unique solution to a system require?
the existence of the inverse A^-1
Rank
the total number of linearly independent rows in a matrix
Singular
when a matrix has linearly dependent rows
What is another code of inv if the the solution is NaN or Inf
pinv(A)
sample set
a population , numerical sequence of probability and statitics
mean
average of a sample set, the function ‘ mean ‘ is used
median
the value which separates a sample set between a lower half and an upper half. matlab code = median
standard deviation
the neighborhood about the mean value which captures 68% of the population
probability distributioin
the relative likelihood (as a ratio) of obtaining a specified outcome, x
uniform distribution
all outcomes are equally probable
normal distribution
a bell curve probability distribution; the further the outcome is from the mean, the less probable
cumulative probability
the cumulative (integrated) likelihood of obtaining a specified range of outcomes
rand
generates a random real number on the open interval (0,1)
rand(m,n)
generates an m x n array of random numbers
randi(imax,m,n)
generates an m x n array of random integers between 1 and imax
randn
generates a random real number using a normal probability distribution
randn(m,n)
generates an m x n array of random numbers using a normal distribution
round(x)
rounds x towards the nearest integer
fix(n)
round x toward zero
hist(x,n)
plots a histogram where x is the sample and n is the number of bins
calculates histogram data
[z,y]=hist(x,n)
bar(y,z)
draws a bar graph that looks like a histogram (especially if y and z are determined using hist command)
How do you create a bar graph with the probability of rolling a die (with 6 different sides) with an input for a number of rolls.
n=input('number of rolls') b=1:6 %possible sides of the die dievalue=randi(6,1,n) [z,y]=hist(dievalue,b) bar(y,z)