MATLAB Answers

Generating stretched cartesian grid for lid driven cavity numerical simulation

6 views (last 30 days)
Burak Pehlivan
Burak Pehlivan on 29 Oct 2017
Answered: Star Strider on 29 Oct 2017
Hi, I'm trying to generate a stretched cartesian grid for lid driven cavity numerical simulation in matlab. So, in a rectangular domain, points/nodes will be closer to each other near the wall compared to mid region of the domain.
How can I generate such a vector? If I have such a vector, then I can generate the grid either with delaunay or meshgrid functions.
Thank you.

  0 Comments

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 29 Oct 2017
Here is one option:
t = linspace(-pi, pi, 50);
v = cos(t);
figure(1)
plot(t, v);
[X,Y] = meshgrid(v);
Z = ones(size(X));
figure(2)
mesh(X, Y, Z)
grid on
Experiment to get the result you want.

  0 Comments

Sign in to comment.

Sign in to answer this question.


Translated by