e934.m

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

M
35
字号
%-------------------------------------------------------------------
% Example 9.3.4: Heat Flow in a Rod 
%-------------------------------------------------------------------

% Initialize 

   clc
   clear
   global a
   m = 50;                % t precision 		
   n = 39;                % x precision 
   c = [0 0]; 	          % boundary condition type
   a = 1;                 % maximum x
   T = 6.0e3;		  % maximum t  
   beta = 1.0e-5;         % thermal diffusivity 

% Find gamma

   fprintf ('Example 9.3.4: Heat Flow in a Rod\n');
   dt = T/m;
   dx = a/(n+1);
   gamma = beta*dt/(dx*dx);
   show ('gamma',gamma)

% Solve heat equation

   disp ('Solving heat equation ...') 
   [t,x,U] = heat1 (T,a,m,n,beta,c,'funf934','fung934');  
   plotxyz (t,x,U,'Heat Flow in a Rod','t','x','u')
%-------------------------------------------------------------------

   


⌨️ 快捷键说明

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