12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

material dullThe default is material default.The material <strong>and</strong> lighting comm<strong>and</strong>s are simple interfaces forchanging the h<strong>and</strong>le graphics properties that affect lighting. See theUsing <strong>MATLAB</strong> Graphics manual for more details. For now, we illustratesome <strong>of</strong> the fine tuning effects that you can achieve. Here is thematlab logo, produced using the membrane function <strong>and</strong> illuminated:clfmembraneh = light(’pos’,[-.5 .5 .1]);pltlightaxis <strong>of</strong>fThe flat region near the light is a constant colour. That is because, bydefault, the light rays are parallel to the line joining the position <strong>of</strong> thelight <strong>and</strong> the centre <strong>of</strong> the plot. To simulate a point source <strong>of</strong> light atthe position <strong>of</strong> the light, set the style property <strong>of</strong> the light to local:set(h,’style’,’local’)As another example, the following uses various reflectance properties<strong>of</strong> the (slightly roughened) sphere, along with a light <strong>of</strong>f to one side, toproduce a simulated crescent moon (see moon.m in companion s<strong>of</strong>tware).First the spherical data points are r<strong>and</strong>omized to produce a slightlyrough sphere:[x,y,z] = sphere(100);N = size(x,1);x = x + r<strong>and</strong>n(N)/1000;y = y + r<strong>and</strong>n(N)/1000;z = z + r<strong>and</strong>n(N)/1000;c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!