EGR 103/Fall 2014/Lab 11

From PrattWiki
Revision as of 14:45, 4 December 2014 by DukeEgr93 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Hints for Problem 4

In the differential equation, note that the numerator involves the ratio between your current and maximum population,

\( \begin{align} \left(1-\frac{p}{p_{\mbox{max}}}\right) \end{align} \)

and not

\( \begin{align} \left(\frac{(1-p)}{p_{\mbox{max}}}\right) \end{align} \)

Hints for Problem 5

Since this is a second order differential equation, you will want to use the following:

\( \begin{align} y(1)&=x \\ y(2)&=\frac{dx}{dt} \end{align} \)

meaning:

\( \begin{align} \frac{dy(1)}{dt}&=\frac{dx}{dt}=y(2) \end{align} \)

To get the derivative of \(y(2)\), you will need to rearrange the equation given in the problem to isolate acceleration. Basically, the equation in the book, in terms of your variables, looks like:

\( \begin{align} m\frac{dy(2)}{dt}+cy(2)+ky(1)&=0 \end{align} \)

Get an equation for \(\frac{dy(2)}{dt}\) and put that in the second line of your dydt code.

Also, keep in mind you are tracking both the position and the velocity of the block. That means, among other things, that you need to have two initial conditions (an initial position and an initial velocity) and you need to only plot the first column of the \(yout\) variable that comes out of the ode45 command. Since there are three different damping ratios, you will need to run the ode45 command three different times.