User Tools

Site Tools


gibson:teaching:fall-2013:math445:hw3

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

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

For each of the following, provide an answer in Matlab-digestable syntax 1. Assign the value 0.00014 to the variable //x//, using compact scientific notation. 2. Set the variable //x// to a vector whose components are the even numbers between 14 and 36. 3. Set the variable //x// to 200 evenly spaced points between 0 and 2. 4. Produce a plot of //y = x^2 - 2x + 3// for the //x// of the previous problem. Label the axes. 5. Plot //tan(x)// versus //x// for 200 evenly spaced points between 0 and 1.57 ≈ pi/2, using a logarithmic scale on the //y// axis. 6. Plot //sin(x)// and //cos(x)// for 200 evenly spaced points between -π and π, on the same plot, using red for //sin(x)// and blue for //cos(x)//. Add a legend that indicates which function is which color. 7. Produce a vector of length 13 whose components are random integers between 0 and 10, inclusive. 8. Produce a vector of length 13 whose components are random real numbers between 0 and 10, inclusive. 9. Show how you would solve the following system of equations with Matlab <code> x + 2y - z = 5 3x + y + 6z = 37 -3x + y + 2z = -11 </code> 10. Write a conditional expression that is true if scalar variables //x// and //y// are both nonzero and false otherwise. 11. Set variable //A// to a 3 x 5 matrix of zeros. 12. Set variable //A// to a 4 x 7 matrix of random real numbers, using a guassian (normal) distribution. 13. Write a conditional expression that is true if a matrix //A// is square and false otherwise. 14. Write a conditional expression that is true if either //x// or //y// is an integer. Write a Matlab function that 15. returns 1 (true) if its argument is divisible by 3 and 0 (false) if it's not. 16. takes a vector //x// as input and returns 1 if the components of //x// are sorted in ascending order, 0 if not. 17. computes the product //y = Ax// of an //m x n// matrix //A// and an //n x 1// vector //x//, according the formula <latex> y_i = \sum_{j=1}^n A_{ij} x_j </latex> **A few more problems, added 1/14/2013** 18. Set vector v to the 3rd column of matrix A. 19. Set vector v to the 4th row of matrix A. 20. Set vector v to the first 3 entries in the 7th row of A. 21. Set the 4th row of the 8 x 5 matrix A to (1, 2, 9, 5, 0). 22. Set the 2nd column of the 4 x 3 matrix A to a column vector with entries (3, 0, -1, 5). 23. Zero all the entries in the last column of a matrix A. 24. Produce a contour plot of $f(x,y) = \sin(x^2+y^2)/\sqrt{x^2 + y^2}$ where //x// and //y// range from -10 to 10. Label the axes.

gibson/teaching/fall-2013/math445/hw3.1381773761.txt.gz · Last modified: 2013/10/14 11:02 by gibson