Surf plot 2D diffusion FEA
Afficher commentaires plus anciens
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



Réponses (1)
darova
le 13 Mai 2019
Try
h=surf(X,Y,C);
shading interp
set(h,'EdgeColor','k')
2 commentaires
Jacopo Cossu
le 13 Mai 2019
darova
le 13 Mai 2019
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)
Catégories
En savoir plus sur Images dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
