contour for scatter data
164 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Antworten (2)
Walter Roberson
am 27 Feb. 2023
Bearbeitet: Walter Roberson
am 28 Feb. 2023
6 Kommentare
Voss
am 7 Mär. 2023
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)
John D'Errico
am 28 Feb. 2023
Bearbeitet: John D'Errico
am 28 Feb. 2023
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
0 Kommentare
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!