Hy,
I'm trying to code a 2D diffusion problem. In the center from -1(mm) to +1(mm) both in x and y direction, the concentration of the solute is 100. The solutes then starts to diffuse in x and y direction with different rate (i.e. the diffusivities in x and y directions are different).
My code is working fine, but when I plot the initial condition (shown in the attached image) using the surf plot, the plot shows the initial condition as yellow color on the grid from -1 to +1.5, but this is misleading. The initial condition is between -1 to 1. I think this is because how the surf plot interprets the matrix and defines the color. You can see in the following images that the Z values on the grid points (the value of concentration) on the top and right hand side of the yellow region is zero.
What I need is to make a plot that shows the initial condition correctly (in this graph only from -1 to +1 colored yellow).
Is there any ways to solve this problem?
I attached the code as well.
Thanks a lot

답변 (1개)

darova
darova 2019년 5월 13일

0 개 추천

Try
h=surf(X,Y,C);
shading interp
set(h,'EdgeColor','k')

댓글 수: 2

Jacopo Cossu
Jacopo Cossu 2019년 5월 13일
Hy,
thanks for your suggestion. I tried it out, but now it shows a gradient coloring along the edge of the yellow box in the center. I would like to have the edge completely blue.
2D-diffusion.jpg
Whaat if modificate original data a little
[row, ~] = find(C==100,1,'last');
[~, col] = find(C==100,1,'first');
C1 = C;
C1(row,:) = 0;
C1(:,col) = 0;
surf(X,Y,C1)

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

질문:

2019년 5월 12일

댓글:

2019년 5월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by