contour for scatter data

조회 수: 30 (최근 30일)
Pegah
Pegah 2023년 2월 27일
편집: Walter Roberson 2023년 8월 1일
Hi every one,
I have 3 columns of data X, Y, and T. I used "svd" function for T and now I need to visulaize T considering X, and Y. How could I use "contour" or "contourf" for this data? the problem is, I cann't use "meshgrid" function because the grid that I used is not organised.
Thanks in advance,
  댓글 수: 1
Totanly
Totanly 2023년 8월 1일
편집: Walter Roberson 2023년 8월 1일
see this link, i think it will solve your problem

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

답변 (2개)

Walter Roberson
Walter Roberson 2023년 2월 27일
편집: Walter Roberson 2023년 2월 28일
  댓글 수: 6
Voss
Voss 2023년 3월 7일
@Pegah: Include 'EdgeColor','none' in the call to patch():
filename = 'export.csv';
xyzt = readmatrix(filename, 'Range', "7:512");
faceinfo = readmatrix(filename, 'Range', "515:969");
p = patch( ...
'Faces', faceinfo + 1, ...
'Vertices', xyzt(:,1:3), ...
'FaceColor', 'interp', ...
'FaceVertexCData', xyzt(:,4), ...
'EdgeColor', 'none');
view(3)
Pegah
Pegah 2023년 3월 7일
It works, Thank you so much.

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


John D'Errico
John D'Errico 2023년 2월 28일
편집: John D'Errico 2023년 2월 28일
Let me give an example of how to use a tricontouring tool for scattered data.
x = rand(100,1);
y = rand(100,1);
zfun = @(x,y) sin(x + y).*cos(x-2*y) - x;
z = zfun(x,y);
% Note the use of an alpha shape to generate the triangulation.
% This is important, as otherwise, there will be significant edge
% artifacts.
S = alphaShape(x,y);
S.Alpha = .3;
plot(S)
That is merely the triangulation. Again, it is based purely on the variables x and y.
trisurf(S.alphaTriangulation,x,y,z)
tricontour(S.alphaTriangulation,x,y,z,10)
hold on
plot(x,y,'ro')
colorbar

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by