Effacer les filtres
Effacer les filtres

Help with plotting the figure

2 vues (au cours des 30 derniers jours)
Rasel Munshi
Rasel Munshi le 15 Avr 2018
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

Réponses (0)

Catégories

En savoir plus sur Contour Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by