====== Math 445 exam 1 example questions ====== 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$. (By "odd-numbered elements", I mean the elements with odd indices, e.g. $v_1, v_3, \ldots$.) **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^n \frac{x^{2n+1}}{(2n+1)!} \end{equation*} **Note: an earlier version of this problem had an error in the Taylor series of** $\sin x$. **Problem 5:** (straightforward) Write Matlab code that would solve the system of equations. \begin{eqnarray*} 3x + y + 2z - 6 &= 0 \\ 9z - x - 8 &= 0 \\ 5y - 4x - 1 &= 0 \end{eqnarray*} **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{equation*} \text{mean}(x) = \frac{1}{N}\sum_{i=1}^{N} x_i \end{equation*} 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 |}}