User Tools

Site Tools


gibson:teaching:fall-2014:math445:hw2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
gibson:teaching:fall-2014:math445:hw2 [2014/09/15 11:53]
gibson created
gibson:teaching:fall-2014:math445:hw2 [2014/09/22 09:06] (current)
gibson
Line 4: Line 4:
  
   sum, any, all, linspace   sum, any, all, linspace
-  plot, semilogy, semilogx, xlabel, ylabel, legend, axis+  plot, semilogy, semilogx, xlabel, ylabel, legend, axis,  
 +  hist, randn
  
 **Problem 1:** Write a Matlab expression that sums the first N of each series and evaluate it for N=100. **Problem 1:** Write a Matlab expression that sums the first N of each series and evaluate it for N=100.
Line 33: Line 34:
 **Problems 5-11:** Turn in the Matlab code and the figures. Always label the figures appropriately,​ using ''​title'',​ ''​xlabel''​ and either ''​ylabel''​ or ''​legend''​. The figures should be titled "​Problem 5", etc. Read ''​help''​ for the following functions and then experiment with them to see how they affect the plot. **Problems 5-11:** Turn in the Matlab code and the figures. Always label the figures appropriately,​ using ''​title'',​ ''​xlabel''​ and either ''​ylabel''​ or ''​legend''​. The figures should be titled "​Problem 5", etc. Read ''​help''​ for the following functions and then experiment with them to see how they affect the plot.
  
-  clf +  ​figure, ​clfhold onhold off 
-  ​hold on +  gridxticks, yticks ​ 
-  ​hold off +  ​axis([xmin xmax ymin ymax), axis equal, axis square
-  figure +
-  grid +
-  ​xticks +
-  ​yticks ​+
  
 **Problem 5:** Plot sin(x) versus x for 100 evenly space points in x from 0 to 2pi, using a solid blue line. **Problem 5:** Plot sin(x) versus x for 100 evenly space points in x from 0 to 2pi, using a solid blue line.
Line 45: Line 42:
 **Problem 6:** Plot sin(x) in red, cos(x) in green, over same x as problem 5. Use '​legend'​ to indicate which function is shown in which color. ​ **Problem 6:** Plot sin(x) in red, cos(x) in green, over same x as problem 5. Use '​legend'​ to indicate which function is shown in which color. ​
  
-**Problem 7:** Plot $y = 5x^2 - 4x - 3$ for 100 evenly space points in x from -2 to 2. Superimpose an x,y grid on the plot.+**Problem 7:** Plot $y = 5x^2 - 4x - 3$ for 40 evenly space points in x from -2 to 2, using a red line and a circle on each data point. Superimpose an x,y grid on the plot.
  
 **Problem 8:** Make a plot of the unit circle. Make sure it's closed --no gap! Hint: use ''​linspace''​ to specify a range of angles, then ''​cos''​ and ''​sin''​ to produce vectors of the x,y coordinates of points on the unit circle. **Problem 8:** Make a plot of the unit circle. Make sure it's closed --no gap! Hint: use ''​linspace''​ to specify a range of angles, then ''​cos''​ and ''​sin''​ to produce vectors of the x,y coordinates of points on the unit circle.
Line 55: Line 52:
 appropriate plotting function. Again, it ain't ''​plot''​! appropriate plotting function. Again, it ain't ''​plot''​!
  
-**Problem 11:** Make a histogram of 1000 random numbers from a normal (Gaussian) distribution. ​+**Problem 11:** Make a histogram of 1000 random numbers from a normal (Gaussian) distribution. Use Matlab'​s ''​hist''​ and ''​randn''​ functions.
  
gibson/teaching/fall-2014/math445/hw2.1410807187.txt.gz · Last modified: 2014/09/15 11:53 by gibson