How can we generate points with an increasing interval?

11 views (last 30 days)
Dear Matlab People,
Could you please tell me how I can generate points with an increasing interval? The function 'linspace' creates at an constant interval. Actually, I am trying a four-noded mesh of a rectangular plate. The mesh size shall increase in both horizontal and vertical directions.
Thanks
  2 Comments
jonas
jonas on 3 Sep 2018
Well, there are infinite numbers of ways to achieve this, depending on your desired interval. For example:
x=linspace(1,10,10)
x=exp(x)
What are you looking for specifically?
Stephen23
Stephen23 on 4 Sep 2018
Shivani Rani's "Answer" moved here:
Thank you for replying.
Using Linspace and Meshgrid commands, I created a mesh (see the image). In this mesh, the elements are relatively of same size. Becuase of this, I am getting too coarse mesh and then my analysis is taking too long to perform. I was wondering if there is a way that I can have a mesh grid in which there is a finer mesh near the edge (left corner) and then increases in both horizontal and vertical direactions. This way, I can reduce the computation time.

Sign in to comment.

Answers (2)

Jeff Miller
Jeff Miller on 4 Sep 2018
Try using logspace instead of linspace.

jonas
jonas on 4 Sep 2018
Edited: jonas on 4 Sep 2018
You have to play around with the X and Y coordinates to get the type of mesh you are looking for. Easiest I can think of is the following, which creates a 50x50 element mesh similar to the one you described.
[X,Y]=meshgrid(0:50,0:50);
X=X.^2./X(end).^2
Y=Y.^2./Y(end).^2
plot(X,Y,'k',...
Y,X,'k')

Community Treasure Hunt

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

Start Hunting!