EML 3002L M.E. Tools Lab 10/04/18
Matlab Exam 1 Van Dommelen 12:30-1:45 pm

NO CELL PHONES, HEADPHONES/BUDS, NO CALCULATORS. SAVE FREQUENTLY. SAVE BEFORE PUBLISHING!!!

ONLY MATLAB MAY BE ACTIVE ON YOUR COMPUTER. Acrobat may only be open at the end, when you are ready except for publishing and actively looking at exam1q1.pdf, exam1q2.pdf, or exam1q3.pdf with it.

VARIABLE NAMES MUST BE APPROPRIATE AND CLEARLY SHOW WHAT VARIABLE IT IS OR A 50% CREDIT REDUCTION IS APPLIED.

After translation into mathematics, only Matlab may be used to solve the full problem as posed. Use the appropriate procedures as covered in the lectures.

“Open notes: print-outs of lectures and homeworks allowed. You can also use your own homework .m files.”

  1. In his 1609 Astronomia Nova Kepler derived the following equation to find the position of celestial bodies in orbit around other bodies:

    \begin{displaymath}
M = E - e \sin(E)
\end{displaymath}

    This equation is to be solved for $E$ given $M$ and $e$. In 1621 Kepler proposed an iterative solution to this equation. But with Matlab, simpler procedures can be used of course.

    Create a function file Kepler.m that will accept $E$, $M$ and $e$ as input arguments and that can be used by fzero to find $E$.

    Next use this function file to find $E$ in two cases. Both have $e=\frac12$, but the first has $M=\pi/4$ and the second $M=3\pi/4$. (Note that Kepler's equation is trivial whenever $M$ is a whole multiple of $\pi$.)

    First, in a single plot, plot the output of your function file against $E$ for $0\le{}E\le\pi$ for both cases. Use a grid and a legend.

    Based on the plot find the two values for $E$ using fzero. In both cases, use the interval method. The end points of your intervals should be integers or half integers and the interval should be no longer than half a unit. Print the results out as

       For e = 1.123 and M = 1.12345, E = 1.12345 (interval [1.123 1.123]).
    Absolutely no data values inside the FORMATSTRING.

    Grading

  2. Create 50 noisy data points for $\sin(x)$ as
      rng('default')
      fVals=sin(xVals)+0.1*randn(size(xVals));
    where xVals is an array of 50 equally spaced $x$-values in the range $-\pi/2\le{}x\le\pi/2$. Now fit a quintic to the noisy data. Print out the maximum error in the fit, compared to $\sin(x)$, at 100 plot points in the mentioned range as
       The quintic fit has a maximum error 1.12E12
    Absolutely no data values inside the FORMATSTRING.

    Next plot the exact $\sin(x)$ as well as its derivative $\cos(x)$ as black broken lines, the noisy data as black circular symbols, and the fitted quintic and its derivative as blue lines, all in a single plot. Use a grid. Use a horizontal axis from $-\pi/2$ to $\pi/2$ and a horizontal axis from -1.2 to 1.2.

    Grading

  3. Consider the system of ODE
     $\displaystyle \frac{{\rm d}p}{{\rm d}y} = u \qquad
\frac{{\rm d}u}{{\rm d}y} = o \qquad
\frac{{\rm d}o}{{\rm d}y} = -p*o$      (1)

    for the unknowns $p$, $u$, and $o$, which depend on $y$. Put this system in a function file called ODE.m. Note that the independent variable here is called $y$, not $t$. See the exam header for what this means to you (if you want more than 50% credit).

    Next use ode45 to find the solution of this system from $y=0$ to $y=4$. In particular, make ode45 find the unknowns at at least 100 $y$ values between 0 and 4. The initial conditions at $y=0$ are that $p$ and $u$ are zero there and $o=0.47$.

    Now plot $y$ along the vertical axis and $u$ along the horizontal axis in a plot.

    Congratulations. You have just found and plotted the velocity profile of the famous Blasius solution for flow of a viscous substance like air or water along a flush, semi-infinite plate. The coordinate $y$ is the distance from the plate and $u$ the velocity component parallel to the plate.

    Add an appropriate title and axis labels to the plot.

    Grading

Solutions without credit distribution.
Solutions with credit distribution.