User Tools

Site Tools


gibson:teaching:spring-2016:math445:exam1sample

**This is an old revision of the document!** ----

A PCRE internal error occured. This might be caused by a faulty plugin

The exam will have around ten questions, some easy, some not so easy. For most questions, you will be asked to answer with Matlab code in correct syntax. E.g. **Problem 1:** (totally straightforward) Given a matrix $A$, write one line of Matlab code that would assign the 3rd row of $A$ into the variable $x$. **Problem 2:** (slightly tricky) Given a matrix $A$, write one line of Matlab code that convert the $j$th column of $A$ into a row vector and assign it to the variable $x$. **Problem 3:** (pretty straightforward) Given a vector $v$, write one or two lines of Matlab code that would return all the odd-numbered elements of $v$. **Problem 4:** (moderate) Write Matlab code that defines a function named ''mysin'' that computes $\sin(x)$ using the truncated power series \begin{equation*} \sin(x) \doteq \sum_{n=0}^{10} -1^{2n+1} \frac{x^{2n+1}}{(2n+1)!} \end{equation*} **Problem 5:** (straightforward) Write Matlab code that would solve the system of equations. \begin{align*} 3x + y + 2z - 6 &= 0 \\ 9z - x - 8 &= 0 \\ 5y - 4x - 1 &= 0 \end{align*} **Problem 6:** (straightforward) Write a Matlab function that computes the mean (i.e. average) of the components of a vector $x$ according to the formula \begin{align*} \text{mean}(x) = \frac{1}{N}\sum_{i=1}^{N} x_i \end{align*} where $N$ is the length of the vector. Your function should evaluate this sum directly using a **for** loop, not by calling Matlab's **sum** or **mean** function. You did this for lab, now see if you can do it without looking at notes. **Problem 7:** (straightforward) Write a few lines of Matlab code that would plot $4x^3 + 3x^2 - 2x - 7 $ versus $x$ on the interval $ -3 \leq x \leq 3$ using a red dashed line. Label the axes. **Problem 8:** (a little harder than 7) Write a few lines of Matlab code that would plot $y(x) = 5 x^{-4}$ on the interval $1 \leq x \leq 10$, using the plotting function that would best highlight the functional relation between $y$ and $x$. Label the axes. **Problem 9:** Deduce the functional relationship $y(x)$ from this graph. {{ :gibson:teaching:spring-2016:math445:exam1:semilogy.png?direct&400 |}}

gibson/teaching/spring-2016/math445/exam1sample.1456864275.txt.gz · Last modified: 2016/03/01 12:31 by gibson