⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 e792.m

📁 matlab算法集 matlab算法集
💻 M
字号:
%-----------------------------------------------------------------------
% Example 7.9.2: Dam Design 
%-----------------------------------------------------------------------

% Initialize

   clc                          % clear screen
   clear                        % clear window
   global x y Z                 % used by funf792.m
   q = 40;                      % number of x plot points 
   r = 80;                      % number of y plot points  	
   s = 300;                     % number of random points  	
   a = zeros (2,1);             % limits on x (m) 
   b = zeros (2,1);             % limits on y (m) 
   x1 = zeros (q,1);
   y1 = zeros (r,1);
   Z1 = zeros (q,r);
   randinit (1000)
   
% Get pond depth data: x,y,Z

   fprintf ('Example 7.9.2: Dam Design\n');
   data792                      % read in depth data x,y,Z 
   [m,n] = size(Z);

% Plot surface 
   
   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);
   plotxyz (x1,y1,Z1,'Pond Depth','x (m)','y (m)','z (m)')

% Compute volume of water in pond 

   a(1) = x(1);
   a(2) = y(1);
   b(1) = x(m);
   b(2) = y(n);
   disp ('Integrating ... ')
   V = -monte(a,b,s,'funf792');
   show ('Volume of water (m^3))',V); 
   
% Compute force on dam 

   F = simpson (x(1),x(m),100,'fung792'); 
   show ('Force on dam (kg/(m-s^2))',F);
%-----------------------------------------------------------------------

⌨️ 快捷键说明

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