Section 2

week of September 7
 

Get on a machine with matlab.  Type matlab at the command line to start.  the following commands will give you the heights for a bumpy mesh as in the professor's example.

>> [X,Y] = meshgrid([-5:5],[-5:5]);
>> Z=sin(14*X+2)+sin(14*Y);
>> fid = fopen('heights.txt','w');
>> fprintf(fid,'%6.3f, ',Z);

heights.txt will contain the height values separated by comma's (plus an extra comma at the end of the file, you should erase this one).  There will be 11x11 = 121 values in this example.  You would insert these values into the an ElevationGrid node in the height field.  If you need help with Matlab there is a help command.  Functions like rand are useful, as is surf which can let you preview your surface in matlab (you have to be on an terminal with the display set correctly, etc.).


aberg@cs.berkeley.edu