Boundary and smooth the figure

조회 수: 2(최근 30일)
댓글: Abdulkarim Almukdad 2021년 3월 4일
I have a very larg data (X, Y, Z) and I used some codes to read the data then remove the columns that contain NaN. The below codes are used after the previous description to plot a 2D graph or 3D with Z being indicated by colors. I tried pcolor and surf but I'm getting the same two problems; 1- the figure is supposed to be perfect x-shape with an angle of 30, but in the middle some portions are connected together which is incorrect. 2- I'm looking for a way to smooth the figure in which the portions where high value of Z be distributed somehow on the adjacent points so that it can be very clear that at this location we have high value of Z (i.e., in my plots this high Z value is showing as a point). I hope that someone can help me doing this. Thanks in advance
x0 = min(x) ; x1 = max(x) ;
y0 = min(y) ; y1 = max(y) ;
xi = linspace(x0,x1,150) ;
yi = linspace(y0,y1,150) ;
[X,Y] = meshgrid(xi,yi) ;
Z = griddata(x,y,z,X,Y) ;
% Get boundary coordinates
idx = boundary(x,y) ;
xb = x(idx) ; yb = y(idx) ;
% Get points lying inside the boundary
idx = inpolygon(X,Y,xb,yb) ;
Z(~idx) = NaN ;
f=pcolor(X,Y,Z);
colorbar
axis('equal')
댓글 수: 8표시숨기기 이전 댓글 수: 7
Thank you very much for your help. I think I have an idea that might solve this issue but I have zero knowledge about how to do it on matlab unfortunately. I think if the data of each side of the x is ploted and found its boundary, then the combination of both boundaries can do the job. I will try to separate the sides from excel manually by checking each column from simple plottings then I will check what will happen in matlab.

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

Community Treasure Hunt

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

Start Hunting!

Translated by