MATLAB Answers

How to create a non-uniform 2d grid?

163 views (last 30 days)
Ganesh kumar Badri narayan
Commented: darova on 1 Apr 2020 at 13:53
Hi all, I have created a grid as shown in below image
But my aim is to create a grid in the following way
Can anyone help me in creating this type of mesh. Please find below code,
clear all
clc
L=1;
nx=50;
ny=50;
x1=linspace(0,0.4,10);
x2=linspace(0.42,1,40);
x=cat(2,x1,x2);
y1=linspace(0,0.4,10);
y2=linspace(0.42,1,40);
y=cat(2,y1,y2);
[X,Y]=meshgrid(x,y);
plot(X,Y,'k',Y,X,'k');
Thank you all.

  0 Comments

Sign in to comment.

Answers (1)

Venkata Siva Krishna Madala
Hi Ganesh,
I understand that you are trying to create a Mesh(2nd image) with non-uniform width between the lines. My understanding is that you would like to change/increase the line width when compared to the first image. Please correct me if I am wrong.

  7 Comments

Show 4 older comments
Yeru Shang
Yeru Shang on 19 Apr 2018
Thank you Venkata, your answer is very helpful!
Paul Safier
Paul Safier on 31 Mar 2020 at 23:56
How about for a non-uniform 3D mesh?
darova
darova on 1 Apr 2020 at 13:53
Do you have a picture?

Sign in to comment.

Sign in to answer this question.