Point array to generate meshgrid
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a point array describing the equal-spacing points in a hexagon, how can I use this array to generate a meshgrid with identical points so that I can use pcolor?
0 Kommentare
Antworten (2)
Walter Roberson
am 15 Dez. 2023
Xu = uniquetol(X(:) );
Yu = uniquetol(Y(:) );
[Xg, Yg] = meshgid(Xu, Yu);
F = scatteredInterpolant(X(:), Y(:), Z(:)) ;
Zg = F(Xg, Yg);
pcolor(Xg, Yg, Zg);
3 Kommentare
Walter Roberson
am 15 Dez. 2023
The locations that are outside of the convex hull of the original points, will interpolate to NaN, and pcolor() displays NaN as transparent.
Huiyuan Zheng
am 18 Dez. 2023
Bearbeitet: Huiyuan Zheng
am 18 Dez. 2023
Steven Lord
am 15 Dez. 2023
I don't believe pcolor allows you to create elements with more or fewer than 4 sides. What I think you want to do is either create various patch objects or perhaps create an array of polyshape objects and use some of the object functions (rotate, scale, translate) to create an array of polyshape objects to plot.
H = nsidedpoly(6);
plot(H)
axis equal
H(2) = translate(H, 2, 0); % Now H has 2 hexagons
H(3:4) = translate(H, 0, 2); % Now it has 4, both of the previous two translated up 2 units
figure
plot(H)
axis equal
Siehe auch
Kategorien
Mehr zu Elementary Polygons finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!