%%% consurf.m: to run this script, at the matlab prompt type %%% consurf %%% %%% contains sample contour and surface plots %%% %%% requires data file mydata.dat echo on % clear text window, clear/reset graphics window clc clf reset % load file mydata.dat, stored in matrix mydata load mydata.dat %%%%%%%%%%%% 2-D contours %%%%%%%%%%%%% % plot contour of mydata matrix, store result in variable cs cs = contour(mydata); %Press any key to continue pause % add labels to contour plot stored in cs clabel(cs); %Press any key to continue pause % color contour plot where color is proportional to height pcolor(mydata); %Press any key to continue pause %%%%%%%%%%%% surfaces %%%%%%%%%%%%% % wire mesh plot of surface mydata (hidden toggles hidden line removal) mesh(mydata), title('Mesh Surface'), xlabel('x-axis'), ylabel('y-axis'), zlabel('z-axis'); %Press any key to continue pause % surface plot of mydata surf(mydata); %Press any key to continue pause % smoothly interpolated surface plot of mydata with lighting surfl(mydata), shading interp, colormap(pink); %Press any key to continue pause %%%%%%%%%%%% contours & surfaces %%%%%%%%%%%%% % set desired colormap colormap(jet); % wire mesh surface of mydata with underlying contour meshc(mydata); %Press any key to continue pause % surface plot of mydata with underlying contour surfc(mydata); %Press any key to continue pause % smooth surface plot, with do not erase option surfl(mydata), shading interp, colormap(bone); hold on; %Press any key to continue pause % so we can add 3-D contour lines to it contour3(mydata); %Press any key to continue pause %%%%%%%%%%%%%% viewpoints %%%%%%%%%%%%%%%%% % view(azimuth, elevation) view(0,90); %Press any key to continue pause view(45,60); %Press any key to continue pause view(90,15); %Press any key to continue pause view(3); echo off