This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
gibson:teaching:fall-2012:math445:hw1 [2012/09/24 19:41] gibson created |
gibson:teaching:fall-2012:math445:hw1 [2012/09/26 20:28] (current) gibson |
||
---|---|---|---|
Line 10: | Line 10: | ||
5. Plot //tan(x)// versus //x// for 200 evenly spaced points between 0 and 1.57 ≈ pi/2, using | 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. | + | a logarithmic scale on the //y// axis. |
- | 6. Produce a vector whose components are random integers between 0 and 10, inclusive. | + | 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 whose components are random real numbers between 0 and 10, inclusive. | + | 7. Produce a vector whose components are random integers between 0 and 10, inclusive. |
- | 8. Show how you would solve the following system of equations with Matlab | + | 8. Produce a vector 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> | <code> | ||
Line 24: | Line 27: | ||
</code> | </code> | ||
- | 9. Write a conditional expression that is true if scalar variables //x// and //y// are both nonzero | + | 10. Write a conditional expression that is true if scalar variables //x// and //y// are both nonzero |
and false otherwise. | and false otherwise. | ||
- | 10. Set variable //A// to a 3 x 5 matrix of zeros. | + | 11. Set variable //A// to a 3 x 5 matrix of zeros. |
- | 11. Set variable //A// to a 4 x 7 matrix of random real numbers, using a guassian (normal) distribution. | + | 12. Set variable //A// to a 4 x 7 matrix of random real numbers, using a guassian (normal) distribution. |
- | 11. Write a conditional expression that is true if a matrix //A// is square and false otherwise. | + | 13. Write a conditional expression that is true if a matrix //A// is square and false otherwise. |
- | 12. Write a conditional expression that is true if either //x// or //y// is an integer. | + | 14. Write a conditional expression that is true if either //x// or //y// is an integer. |
Line 39: | Line 42: | ||
Write a Matlab function that | Write a Matlab function that | ||
- | 6. returns 1 (true) if its argument is divisible by 3 and 0 (false) if it's not. | + | 15. returns 1 (true) if its argument is divisible by 3 and 0 (false) if it's not. |
- | 7. computes the mean and standard deviation of the components of a vector //x//. | + | 16. takes a vector //x// as input and returns 1 if the components of //x// are sorted |
- | + | ||
- | 8. takes a vector //x// as input and returns 1 if the components of //x// are sorted | + | |
in ascending order, 0 if not. | in ascending order, 0 if not. | ||
- | 10. finds a zero of another function using the bisection search algorithm | + | 17. finds a zero of another function using the bisection search algorithm. |
+ | |||
+ | 18. 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> | ||
+ | |||