User Tools

Site Tools


gibson:teaching:fall-2014:math445:lab6

This is an old revision of the document!


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

====== Math 445 Lab 6: 3D graphics ====== Important matlab commands: **linspace, meshgrid, pcolor, surf, contour, surfc, contourf, quiver, mesh, load, subplot, pcolor, shading**. ===== Problem 1: pcolor, meshgrid, shading, subplot ===== 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 this figure: {{:gibson:teaching:fall-2012:math445:a.png?nolink&500|}} 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 this figure: {{:gibson:teaching:fall-2012:math445:lab10-fig2.png?nolink&500|}} ===== Problem 2: surf ===== Create a 2D mesh from −π to π with 20 points in both the ''x'' and ''y'' directions, let ''z = cos(x) sin(y)'' pointwise, and then recreate this figure using the ''surf'' and ''colorbar'' commands. {{:gibson:teaching:fall-2012:math445:lab10-fig3.png?400|}} ===== Problem 3: surf in the shade ===== Create a 2D mesh from −10 to 10 with 100 points in both the ''x'' and ''y'' directions, let $r = \sqrt{x^2 + y^2}$ and ''%%z = 5 sin(r)/r%%''. Then recreate Figure 4 using the ''surf'' and ''shading'' commands. {{:gibson:teaching:fall-2012:math445:lab10-fig4.png?500|}}

gibson/teaching/fall-2014/math445/lab6.1416258718.txt.gz · Last modified: 2014/11/17 13:11 by gibson