Example 05
mesh(x,y,z), meshc(x,y,z), meshz(x,y,z), surf(x,y,z), waterfall(x,y,z)
GIVEN: A set of 3-D data (x,y,z).
REQUIRED: Plot the data.
SOLUTION: Generate example05.m
num_of_rows=0:.5:6;
num_of_cols=0:.5:4;
z=[100 99 100 99 100 99 99 99 100;
100 99 99 99 100 99 100 99 99;
99 99 98 98 100 99 100 100 100;
100 98 97 97 99 100 100 100 99;
101 100 98 98 100 102 103 100 100;
102 103 101 100 102 106 104 101 100;
99 102 100 100 103 108 106 101 99;
97 99 100 100 102 105 103 101 100;
100 102 103 101 102 103 102 100 99;
100 102 103 102 101 101 100 99 99;
100 100 101 101 100 100 100 99 99;
100 100 100 100 100 99 99 99 99;
100 100 100 99 99 100 99 100 99];
subplot(2,2,1); mesh(num_of_cols,num_of_rows,z)
subplot(2,2,2); meshc(num_of_cols,num_of_rows,z)
subplot(2,2,3); meshz(num_of_cols,num_of_rows,z)
subplot(2,2,4); surf(num_of_cols,num_of_rows,z)
figure
waterfall(num_of_cols,num_of_rows,z)
Example
Homework:
a. Change the view angle
Please send questions or suggestions about this web page to beatnic@aset.psu.edu
ASET | ITS | Penn State
|