# Erasing part of contourf diagram (L-shaped diagram using contourf)

2 views (last 30 days)
FEM_Analysis_1000 on 23 Dec 2019
Commented: FEM_Analysis_1000 on 24 Dec 2019
I have three matrices. First one is values of temperatures in (x,y) points, and second and third matrix is x and y coordinates, respectively. Rectangular block with temperatures is on figure(1) and it looks appropriately, but when I tried to neglect the values x>2 and y<2, to get L-shaped diagram, it doesn't look fine. Is there any solution to this problem? I submit the picture how the figure(2) should look. Temp=[20 20 20 20 20; % y=0
18 18 18 18 18; % y=1
16 16 16 16 16; % y=2
14 14 14 14 14; % y=3
12 12 12 12 12]; % y=4
x_points=[0 1 2 3 4;
0 1 2 3 4;
0 1 2 3 4;
0 1 2 3 4;
0 1 2 3 4];
y_points=[0 0 0 0 0;
1 1 1 1 1;
2 2 2 2 2;
3 3 3 3 3;
4 4 4 4 4];
figure(1) % Rectangular block with temperatures
contourf(x_points,y_points,Temp)
figure(2) % L-shaped block with temperatures
Temp1=Temp
Temp1(1:2,4:5)=NaN
contourf(x_points,y_points,Temp1)

darova on 23 Dec 2019
try
ind = x_points > 2 & y_points < 2;
temp(ind) = nan;

#### 1 Comment

FEM_Analysis_1000 on 24 Dec 2019
Again, the same diagram like in my case. This part of the code is attached below. Probably, since we have temperature values in discrete points (integer numbers between 0 and 4), there is no way get the diagram I want. We will always have a "jump" in region (2<x<3 & 1<y<2) for this choice of NaN points.
figure(2) % L-shaped block with temperatures
Temp1=Temp
Temp1(1:2,4:5)=NaN
contourf(x_points,y_points,Temp1)