This shows you the differences between two versions of the page.
Next revision | Previous revision Last revision Both sides next revision | ||
gibson:teaching:fall-2014:math445:hw5 [2014/10/13 12:47] gibson created |
gibson:teaching:fall-2014:math445:hw5 [2014/10/13 12:49] gibson |
||
---|---|---|---|
Line 5: | Line 5: | ||
1. Write a function ''mymean'' that uses a ''for'' loop to compute the mean of the elements of its input vector. Test that it's correct by comparing to Matlab's built-in ''mean'' function on a random vector. | 1. Write a function ''mymean'' that uses a ''for'' loop to compute the mean of the elements of its input vector. Test that it's correct by comparing to Matlab's built-in ''mean'' function on a random vector. | ||
- | 2. Write a function ''mystd'' that uses a ''for'' loop to computes the standard deviation of the elements of its input vector. Test by comparison Matlab's built-in ''std'' function on a random vector. | + | 2. Write a function ''mystd'' that uses a ''for'' loop to computes the standard deviation of the elements of its input vector. Test by comparison to Matlab's built-in ''std'' function on a random vector. |
- | 3. Write a script that produces a 10 x 10 multiplication table in the form | + | 3. Write a script that produces a 10 x 10 multiplication table whose first three lines are |
<code> | <code> | ||
Line 24: | Line 24: | ||
\begin{eqnarray*} | \begin{eqnarray*} | ||
- | y_i = sum_{j=1^N} A_{ij} x_j | + | y_i = \sum_{j=1}^N A_{ij} x_j |
\end{eqnarray*} | \end{eqnarray*} | ||
Line 33: | Line 33: | ||
\begin{eqnarray*} | \begin{eqnarray*} | ||
- | C_{ij} = sum_{j=1^N} A_{ik} C_{kj} | + | C_{ij} = \sum_{k=1}^N A_{ik} C_{kj} |
\end{eqnarray*} | \end{eqnarray*} | ||
where //N// is the number of columns of //A//. If A is //M x N// and //B// is //N x P//, then //C// is //M x P//. If //A// and //B// do not have compatible dimensions, print an error message and return a //0 x 0// matrix. | where //N// is the number of columns of //A//. If A is //M x N// and //B// is //N x P//, then //C// is //M x P//. If //A// and //B// do not have compatible dimensions, print an error message and return a //0 x 0// matrix. | ||
- | |||