www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/DefaultGridExample.m
%% Default Grid %% Section 1 % This example shows how you can use the default grid instead of the full % grid to produce a plot. %% % Create a grid and a function that you want to plot. [X,Y] = meshgrid(11:15,11:16); Z = X.^2 + Y.^2; %% % Use the full grid that you created with |meshgrid| by using |X| and |Y|. figure surf(X,Y,Z) title('Full Grid') %% % In contrast, have MATLAB create a default grid instead of using % the full grid. figure surf(Z) title('Default Grid') %% % Notice the difference in the scaling of the axes. When you plot the full % grid the |X|- and |Y|-axis have ranges of 11 to 15 and 10 to 16 % respectively. When you plot the default grid the |X|- and |Y|-axis have % ranges of 1 to m and 1 to n, where |Z| is m-by-n.