Saturday, June 18, 2005

Sample Terrain Data and MATLAB

The terrain data I'm collecting in Second Life is stored in comma delimited text files like this one for Seacliff. The first column in each row is the y coordinate of that row's data. If you happen to have access to MATLAB, you can create a 3D image from this data in three lines:

S = dlmread('Seacliff_Terrain.txt',',');
S = S(:,2:end);
surf (S); figure(gcf)

The first line reads the data into a matrix. The second line removes the first column. The third line plots the surface.

Of course you can create a lot of other different plots. Here's a contour plot with default settings.

1 comment:

NUvV said...

Hey, I'm Interested at sample terrain that you made in MATLAB. Besides that script, could we make a 3-D terrain with 'meshgrid' and 'peaks' tools? How?

~Thank You~