e472.m

来自「matlab算法集 matlab算法集」· M 代码 · 共 36 行

M
36
字号
%----------------------------------------------------------------------
% Example 4.7.2: Water Resource Management
%----------------------------------------------------------------------

   clear
   q = 40;                    % number of x plot points 
   r = 80;                    % number of y plot points  	

   x1 = zeros (q,1);
   y1 = zeros (r,1);
   Z1 = zeros (q,r);

% Get pond depth data: x,y,Z

   fprintf ('Example 4.7.2: Water Resource Management\n');
   data472                    % get pond depth data 
   show ('x',x)
   show ('y',y)
   [m,n] = size(Z);

% Evaluate surface using bilinear interpolation 
   
   for i = 1 : q
      x1(i) = x(1) + (x(m) - x(1))*(i-1)/(q - 1);
   end 	
   for j = 1 : r
      y1(j) = y(1) + (y(n) - y(1))*(j-1)/(r - 1);
   end
   Z1 = bilin (x,y,Z,x1,y1);

% Plot surface 

   plotxyz (x1,y1,Z1,'Pond Depth','x (m)','y (m)','z (m)')
%----------------------------------------------------------------------

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?