User Tools

Site Tools


gibson:teaching:fall-2012:math445:lab10

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
gibson:teaching:fall-2012:math445:lab10 [2012/11/19 14:02]
gibson [Part C: surf in the shade]
gibson:teaching:fall-2012:math445:lab10 [2013/11/06 19:01] (current)
gibson [Part A: pcolor, meshgrid, shading, subplot]
Line 8: Line 8:
 Skim the Matlab documentation for ''​linspace,​ meshgrid,''​ and ''​pcolor''​. Create a 2D mesh from −π to π with 30 points in both the //x// and //y// directions. Then for each position in the mesh let //z = cos(x) sin(y)//. Use ''​pcolor,''​ ''​axis equal,''​ and ''​axis tight''​ to generate the figure on the left. But don't you hate those ugly black lines? You can get rid of them with the ''​shading''​ command. Use ''​subplot''​ and the ''​shading''​ command to generate the figure on the right Skim the Matlab documentation for ''​linspace,​ meshgrid,''​ and ''​pcolor''​. Create a 2D mesh from −π to π with 30 points in both the //x// and //y// directions. Then for each position in the mesh let //z = cos(x) sin(y)//. Use ''​pcolor,''​ ''​axis equal,''​ and ''​axis tight''​ to generate the figure on the left. But don't you hate those ugly black lines? You can get rid of them with the ''​shading''​ command. Use ''​subplot''​ and the ''​shading''​ command to generate the figure on the right
  
-{{:​gibson:​teaching:​fall-2012:​math445:​a.png?​nolink&​400|}} {{:​gibson:​teaching:​fall-2012:​math445:​lab10-fig2.png?​nolink&​400|}}+{{:​gibson:​teaching:​fall-2012:​math445:​a.png?​nolink&​300|}} {{:​gibson:​teaching:​fall-2012:​math445:​lab10-fig2.png?​nolink&​300|}}
  
  
Line 40: Line 40:
  
 {{:​gibson:​teaching:​fall-2012:​math445:​lab10-fig5.png?​500|}} {{:​gibson:​teaching:​fall-2012:​math445:​lab10-fig5.png?​500|}}
 +
 +===== Part E: mystery plot =====
 +
 +
 +Enter the following code into a script file, save the figure produced as a '​.jpg'​ or '​.png'​
 +image, and include it with your project. What does the image produce? What is the role of the '​C' ​
 +variable? ​
 +
 +<​code>​
 +[phi,theta] = meshgrid(linspace(0,​2*pi,​100));​
 +X=(cos(phi) + 3) .* cos(theta);
 +Y=(cos(phi) + 3) .* sin(theta);
 +Z=sin(phi);
 +C=sin(3*theta);​
 +surf(X,​Y,​Z,​C)
 +shading interp
 +</​code>​
 +
 +===== Bonus =====
 + 
 +Draw a Klein bottle in Matlab. Feel free to search the web, but understand whatever you use.
 +
 +Attribution:​ This lab is adapted from Prof.Mark Lyon's Math 445 Advanced Graphics lab, which is adapted from Octave demos at [[http://​yapso.sourceforge.net/​demo/​demo.html]].
gibson/teaching/fall-2012/math445/lab10.1353362534.txt.gz · Last modified: 2012/11/19 14:02 by gibson