# channelflow.org

### Site Tools

gibson:teaching:fall-2014:math445:lab6

# Differences

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

 gibson:teaching:fall-2014:math445:lab6 [2014/11/17 13:11]gibson created gibson:teaching:fall-2014:math445:lab6 [2014/11/17 13:12] (current)gibson 2014/11/17 13:12 gibson 2014/11/17 13:11 gibson created 2014/11/17 13:12 gibson 2014/11/17 13:11 gibson created Line 33: Line 33: {{:​gibson:​teaching:​fall-2012:​math445:​lab10-fig4.png?​500|}} {{:​gibson:​teaching:​fall-2012:​math445:​lab10-fig4.png?​500|}} + Attribution:​ based on Prof. Mark Lyon's "​Advanced Graphics"​ lab for Math 445, which was adapted from an [[http://​yapso.sourceforge.net/​demo/​demo.html | Octave demo]]. + + + ===== Problem 4: surf '​n'​ subplot ​ ===== + + Create a 2D mesh from −π to π with 100 points in both the x and y directions and + then recreate Figure 5, using the functions ''​z = cos(x/2) cos(y/​2)'',​ ''​z = sin(x) cos(y/​2),'' ​ + ''​z = cos(x/2) sin(y)'',​ and ''​z = sin(x) sin(y)''​. + + {{:​gibson:​teaching:​fall-2012:​math445:​lab10-fig5.png?​500|}} + + ===== Problem 5: mystery plot ===== + + + Enter the following code into a script ﬁle, save the ﬁgure 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 + ​ + + ===== 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]]. 