How to plot 2D mesh with a circular area

1 visualizzazione (ultimi 30 giorni)
Matthew Worker
Matthew Worker il 30 Dic 2020
Commentato: VBBV il 30 Dic 2020
Hello,
I want to plot a 2D mesh as shown in this figure:
Here is where i am so far in the code:
rows=251;
columns=257;
[R, C] = meshgrid(1:10:rows, 1:10:columns);
r=size(R);
c=size(C);
Z=zeros(r(1),c(2));
T = delaunay(R,C);
trimesh(T,R,C,Z)
view(0,300)
x=1:40:columns.*3/4;
theta=(0:5:360)*pi/180;
[th,X]=meshgrid(theta,x);
th2=size(th)
X2=size(X)
A=X.*cos(th);
B=X.*sin(th);
C=zeros(X2(1),th2(2));
T2 = delaunay(A,B);
trimesh(T2,A,B,C);
Which shows a mesh of a rectangle and a circle.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by