Matlab:当解决方案处于特定值时,将colormap固定为指定值

时间:2015-02-09 16:54:48

标签: matlab matlab-figure

我用固定的边界条件和消耗项解决了二维几何中的扩散方程。如何在色彩图中添加一个新颜色(或2D图形上的虚线),指定(x-y)图形中某个化学浓度水平?例如,在此代码中,我的色彩图从暗红色变为深蓝色,因为解决方案从顶部的155变为底部的24,我如何为色彩图添加不同的颜色,显示2D图上的位置解决方案18岁?

c = 1e-1;
 a = 0;
 f = char('-22222*u./(2.2+u)');
 d = 1;

 xmin=0;xmax=0.575;ymin=0;ymax=0.05315;ymax2=0.073; 
 gdm = [3;4;xmin;xmax;xmax;xmin;ymax;ymax2;ymin;ymin];
 g = decsg(gdm, 'S1', ('S1')');
 hmax = .1; % element size
[p, e, t] = initmesh(g, 'Hmax', hmax);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
[p,e,t] = refinemesh(g,p,e,t);
 % Create a pde entity for a PDE with a single dependent variable
numberOfPDE = 1;
pb = pde(numberOfPDE);
% Create a geometry entity
pg = pdeGeometryFromEdges(g);
bc1 = pdeBoundaryConditions(pg.Edges(1),'u',155);
bc2 = pdeBoundaryConditions(pg.Edges(2),'u',51);
bc3 = pdeBoundaryConditions(pg.Edges(3),'u',24);
bc4 = pdeBoundaryConditions(pg.Edges(4),'g',0);
pb.BoundaryConditions = [bc1,bc2,bc3,bc4];

u = pdenonlin(pb,p,e,t,c,a,f, 'jacobian', 'lumped');
figure;
pdeplot(p, e, t, 'xydata', u, 'contour', 'on', 'colormap', 'jet');
title 'Chemical Diffusion, Steady State Solution'
xlabel 'X-coordinate, meters'
ylabel 'Y-coordinate, meters'

0 个答案:

没有答案