我是Matlab环境的新手,我正在Matlab(2014b)上进行热传递模拟。我打算有不同材料的多层墙(现在,只有一种材料 - 铜),并将结果显示在一张图上。一切工作正常,直到我试图将第三层墙追加到情节。 下面是基本变量和几何形状对于PDE解算器(R3-R0)的定义:MatLab PDE绘图问题
k = 400;
rho = 8960;
specificHeat = 386;
thick = .01;
stefanBoltz = 5.670373e-8;
hCoeff = 1;
ta = 300;
emiss = .5;
c = thick*k;
a = sprintf('2*%g + 2*%g*%g*u.^3', hCoeff, emiss, stefanBoltz);
f = 2*hCoeff*ta + 2*emiss*stefanBoltz*ta^4;
d = thick*rho*specificHeat;
r0 = [3 4 0 1 1 0 1 1 1.3 1.3];
r1 = [3 4 0 1 1 0 0.6 0.6 1 1];
r2 = [3 4 0 1 1 0 0.3 0.3 0.6 0.6];
r3 = [3 4 0 1 1 0 0 0 0.3 0.3];
现在,下面的代码段,计算通过所述壁的底部层(R3)的热传递,与输入1000 [K]的温度:
gdm = r3';
g = decsg(gdm, 'R3', ('R3')');
hmax = .1; % element size
[p, e, t] = initmesh(g, 'Hmax', hmax);
numberOfPDE = 1;
pb = pde(numberOfPDE);
pg = pdeGeometryFromEdges(g);
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',1000);
pb.BoundaryConditions = uBottom;
u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped');
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ...
u(4));
figure
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet')
hold on
“持有”,我基本上重复前面的代码为“R2”矩形,为“u(4)”(先前层的输出)的输入温度后,随后是最后一位代码:
hold off
axis([0,1,0,2])
caxis manual
caxis([u(4) 1000]);
colorbar;
正如我所说,这是所有工作,第一层和第二层的结果是在同一个阴谋。但是当我重复第三层(r1)的过程并且将结果绘制到原始图中(当然,“hold off”位在代码的最后),该图仅显示结果第三层。我不确定这是否是Matlab的一些限制,或者如果我的解决方案是错误的,所以我想问一些帮助或方向。在此先感谢
下面是更好地了解全码:
k = 400;
rho = 8960;
specificHeat = 386;
thick = .01;
stefanBoltz = 5.670373e-8;
hCoeff = 1;
ta = 300;
emiss = .5;
c = thick*k;
a = sprintf('2*%g + 2*%g*%g*u.^3', hCoeff, emiss, stefanBoltz);
f = 2*hCoeff*ta + 2*emiss*stefanBoltz*ta^4;
d = thick*rho*specificHeat;
r0 = [3 4 0 1 1 0 1 1 1.3 1.3];
r1 = [3 4 0 1 1 0 0.6 0.6 1 1];
r2 = [3 4 0 1 1 0 0.3 0.3 0.6 0.6];
r3 = [3 4 0 1 1 0 0 0 0.3 0.3];
%---------------------------------------------------------
gdm = r3';
g = decsg(gdm, 'R3', ('R3')');
hmax = .1; % element size
[p, e, t] = initmesh(g, 'Hmax', hmax);
numberOfPDE = 1;
pb = pde(numberOfPDE);
pg = pdeGeometryFromEdges(g);
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',1000);
pb.BoundaryConditions = uBottom;
u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped');
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ...
u(4));
figure
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet')
hold on
%----------------------------------------------------------------------
gdm = r2';
g = decsg(gdm, 'R2', ('R2')');
hmax = .1; % element size
[p, e, t] = initmesh(g, 'Hmax', hmax);
numberOfPDE = 1;
pb = pde(numberOfPDE);
pg = pdeGeometryFromEdges(g);
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',u(4));
pb.BoundaryConditions = uBottom;
u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped');
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ...
u(4));
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet')
%----------------------------------------------------------------------------
gdm = r1';
g = decsg(gdm, 'R1', ('R1')');
hmax = .1; % element size
[p, e, t] = initmesh(g, 'Hmax', hmax);
numberOfPDE = 1;
pb = pde(numberOfPDE);
pg = pdeGeometryFromEdges(g);
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',u(4));
pb.BoundaryConditions = uBottom;
u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped');
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ...
u(4));
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet')
%----------------------------------------------------------------------------
gdm = r0';
g = decsg(gdm, 'R0', ('R0')');
hmax = .1; % element size
[p, e, t] = initmesh(g, 'Hmax', hmax);
numberOfPDE = 1;
pb = pde(numberOfPDE);
pg = pdeGeometryFromEdges(g);
uBottom = pdeBoundaryConditions(pg.Edges(1),'u',u(4));
pb.BoundaryConditions = uBottom;
u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped');
fprintf('Temperature at the top edge of the plate = %5.1f degrees-K\n', ...
u(4));
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet')
%hold off
axis([0,1,0,2])
%caxis manual
caxis([u(4) 1000]);
最后的'hold off'和'caxis manual'都没有必要。你可以删除它们。 – Ratbert 2015-02-06 13:28:57
谢谢,但仍然无法解决我的问题,只显示一层墙壁的情节 – 2015-02-06 13:54:26
您可以发布您的整个程序吗? – Ratbert 2015-02-06 14:02:35