📄 e941.m
字号:
%-------------------------------------------------------------------
% Example 9.4.1: Heat Flow in a Plate
%-------------------------------------------------------------------
% Initialize
clc
clear
a = 4; % maximum x
b = 4; % maximum y
m = 20; % t precision
n = 19; % x precision
p = 19; % y precision
T = 1.e4; % final time
beta = 1.0e-4; % thermal diffusivity
% Boundary value function
g = inline ('exp(y)*cos(x) - exp(x)*cos(y)','t','x','y');
% Compute gammas
fprintf ('Example 9.4.1: Heat Flow in a Plate\n');
T = prompt ('Enter final time',0,T,T/2);
dt = T/m;
dx = a/(n+1);
dy = b/(p+1);
gx = beta*dt/(dx*dx);
gy = beta*dt/(dy*dy);
show ('gamma_x',gx);
show ('gamma_y',gy);
% Solve heat equation
disp ('Solving heat equation ...')
[x,y,U] = heat2 (T,a,b,m,n,p,beta,'',g);
caption = sprintf ('Plate Temperature: t = %g',T);
plotxyz (x,y,U,caption,'x','y','u')
%-------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -