matrix show , grain boundaries
Mostra commenti meno recenti

how can i show a matrix like this photo with black line boundaries ?
2 Commenti
KSSV
il 4 Mag 2021
What data you have? You need to have a look on voronoi.
DGM
il 4 Mag 2021
If you're going to ask the same question three times, why do you provide even less information now?
Now I'm reluctant to even answer it if it's just going to get deleted. If all you have is an indexed image, apply edge finding techniques, combine the images. You can keep it indexed or convert it to RGB. Look up fspecial(), imfilter(), edge(), ind2rgb(), colormap(), imshow().
Risposta accettata
Più risposte (1)

This should get you started:
rng default;
n = 100;
x = rand([1 n]);
y = rand([1 n]);
h = voronoi(x,y);
DT = delaunayTriangulation(x(:),y(:));
[V,R] = voronoiDiagram(DT);
verts = cell(size(R));
for i = 1:numel(R)
verts{i} = V(R{i}([1:end,1]),:);
end
hold on
axlims = [xlim; ylim]; % [xlim; ylim]
patchColors = hsv(numel(verts)+1);
for j = 1:numel(verts)
patch(verts{j}(:,1), verts{j}(:,2), patchColors(j,:))
end
delete(h)
set(gca,'color', patchColors(end,:)) % <-- kind of cheating
axis equal
xlim(axlims(1,:))
ylim(axlims(2,:))
Also see these two blog posts by Mike Garrity.
13 Commenti
HG
il 5 Mag 2021
A matrix of what?
Your original question was "how can i show a matrix like this photo with black line boundaries ?" and that's exactly what I answered.
You need to describe the problem much more clearly so that no more time is spent answering a different question.
DGM
il 6 Mag 2021
I'm assuming OP wants a raster copy of the figure. Normally, I just use export_fig
rastercopy = export_fig('-a4','-m2'); % set params accordingly
although I'm sure there are canonical ways of doing that.
HG
il 13 Giu 2021
HG
il 14 Giu 2021
Adam Danz
il 14 Giu 2021
My answer starts with "This should get you started" and when the answer was written, my interpretation of your question was that you were trying to recreate an image similar to the one you shared but with black edge lines. The variable n must be larger for it to work (in my answer, n=100).
In my answer, there is a comment "kind of cheating". That line colors the background. You could remove that line but you won't have a square image.
You question has changed or has become more clear and I recommended above that you turn to the literature and read about Voronoi diagrams. When asking a question, it's very important that you clearly define the goal so you don't get answers to the wrong question.
HG
il 14 Giu 2021
HG
il 14 Giu 2021
ali can kaya
il 2 Ott 2023
do you know how can we add hemicircles inside of this shape
DGM
il 2 Ott 2023
- What defines the size and orientation of the semicircles?
- Are they specifically semicircles or are they just general circular/elliptical arcs?
- Inside of which shape?
- Is this in a raster image or in a diagram drawn in a figure?
I doubt that these details don't matter, so it would make sense to know them ahead of time.
ali can kaya
il 5 Ott 2023
Modificato: Walter Roberson
il 5 Ott 2023
Hi
Do you knoW hoW can I mesh this data for abaqus?
If you have any idea it would help me alot. I tried here delanuay triangulate but did not work
th = linspace( pi/3.4, -pi/2, 100);
R = 0.25; %or whatever radius you want
for i=0:0.2:1
for j=0:0.4:1
x = R*cos(th)+i ;
y = R*sin(th)+j ;
plot (x,y)
hold on
end
end
rng default
x= rand([1 50]);
y= rand([1 50]);
voronoi(x,y)
DT = delaunayTriangulation(x(:),y(:));
[V,R] = voronoiDiagram(DT);
verts = cell(size(R));
for i = 1:numel(R)
verts{i} = V(R{i}([1:end,1]),:);
end
xlim([0 1.3])
ylim([-0.2 1])
Categorie
Scopri di più su Red in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!











