필터 지우기
필터 지우기

Help with plotting the figure

조회 수: 2 (최근 30일)
Rasel Munshi
Rasel Munshi 2018년 4월 15일
I've developed the matlab code for the attached problem (Explicit method). It'll be helpful if someone check my code and correct me if I'm wrong. Also I need help for plotting the figure using contour map in two dimensions. And Finally how to add the stability requirement in the code? Matlab Code:
clc clear close all format long g
%step sizes delx=0.5; X=50; %delta x dely=0.5; Y=20; %delta y delt=1/20; T=20; %delta t Dx=1.0; Dy=0.2; %diffusivity coeff. rx=Dx*delt/delx^2; ry=Dy*delt/dely^2; n=X/delx; m=Y/dely; s=T/delt;
%Initial values C=zeros(n+1,m+1,s+1); %Dimention of the answer matrix
for i=(n/2+1-1/(2*delx)):(n/2+1+1/(2*delx)) for j=(m/2+1-1/(2*dely)):(m/2+1+1/(2*dely)) C(i,j,1)=1000; %initial concentration of the contaminant. end end
%Calculating each row Analytically
for k=1:s for j=2:m for i=2:n C(i,j,k+1)=(1-2*rx-2*ry)*C(i,j,k)+rx*C(i+1,j,k)+rx*C(i-1,j,k)+... ry*C(i,j+1,k)+ry*C(i,j-1,k); end end end

답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by