0
下面的编码是解决从热模型中解耦的连续性方程 我需要根据编码产生冰厚度的3D图形 h_t = B +(D h_x)_x D = Gam | h_x |^(N-1)H ^(N + 2)使用matlab的网格函数
n=3;
L=750000; % meters
dtyear=10;
Nx=30;
type=1;
Mt=ceil(25000/dtyear);
dx=(2*L)/Nx; x=-L:dx:L; % x grid
xmid=-L+dx/2:dx:L-dx/2; % midpt grid
xplot=linspace(-L,L,400); % for plotting analytical soln
iceconstants; %Gam=2*(rho*g)^n*A;
% constants related to grid
dt=dtyear*SperA;
R0=dt/(dx*dx); % presumed related to stability for continuity eqn
Tend=dt*Mt; % final time
t=0:dt:Tend;
% use either steady state analytical soln or zero as initial condition
ic=hexact;
%ic=zeros(1,Nx+1);
% allocate space for solutions
hh=zeros(Nx+1,Mt+1); % hh(j,l) with j for x and l for t
D=zeros(Nx+1,1); %column vector
hh(:,1)=ic'; %insert initial condition
%enforce boundary conditions at start
hh(1,:)=0; hh(Nx+1,:)=0;
D(1)=0; D(Nx+1)=0; % see steady bdry
for l=1:Mt
delh=(hh(2:Nx+1,l)-hh(1:Nx,l))/dx; % Nx by 1 column vector
hav=(hh(2:Nx+1,l)+hh(1:Nx,l))/2; % Nx by 1 col vect
Dmid=(Gam/(n+2))*hav.^(n+2).*abs(delh).^(n-1); % Nx by 1 col vect
F=Dmid.*(hh(2:Nx+1,l)-hh(1:Nx,l));
hh(2:Nx,l+1)=hh(2:Nx,l)+B*dt+R0*(F(2:Nx)-F(1:Nx-1));
end;
tplot=t(tt);
hplot=hh(:,tt);
subplot(3,1,3), mesh(tplot/SperA,x/1000,hplot), view(37.5,30); <--problem in this line
当我运行这种编码,我得到这样的结果
the result shows like this :
??? Error using ==> mesh at 80
Data dimensions must agree.
Error in ==> iceA at 144
subplot(3,1,3), mesh(tplot/SperA,x/1000,hplot), view(37.5,30);
这是什么意思 “的数据维度必须同意”? 我真的很感激,如果u能帮助我:
这太专门化了,可能是由于矩阵/向量的采样或索引错误。尝试模拟错误,用更少的/随机的样本来理解参数和调用'mesh'。 – gevang 2013-03-16 04:41:53