Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Random perturbed uniform mesh in Matlab.... 1

Status
Not open for further replies.

TLamb

Structural
Joined
Nov 21, 2002
Messages
9
Location
GB
Hey guys and gals,
I am trying to generate a random perturbed mesh in Matlab and I an having a bit of problems. Does anyone know any good references that I can use to get an Algorithm or even some sample Matlab code.Or in general any suggestions at all will be welcomed.
Can't wait to see what you'll come up with..

Tony
 
Do you mean a simple rectangular grid whos nodes are shifted in some direction by small random amounts?

A little more information would be useful

M

--
Dr Michael F Platten
 
yes Mickey..you hit the nail on the head.Each small quadrilateral therefore becomes distorted..
Tony
 
Try this
Code:
% define the undeformed mesh
x = [1:10];
y = [1:20];
[X,Y] = meshgrid(x,y);
% define some constant z values (for 3-D plotting)
Z = zeros(length(y),length(x));
% plot the undeformed mesh
figure;
subplot(1,2,1);
mesh(X,Y,Z);
axis([0 11 0 21 -1 1]);
view([0,0,1]);
title('Unperturbed Mesh');
% define the random perturbations
X_rand = (rand(length(y),length(x))-0.5)./3;
Y_rand = (rand(length(y),length(x))-0.5)./3;
% perturb the mesh
X_p = X+X_rand;
Y_p = Y+Y_rand;
% plot the deformed mesh
subplot(1,2,2);
mesh(X_p,Y_p,Z);
axis([0 11 0 21 -1 1]);
view([0,0,1]);
title('Perturbed Mesh');
M

--
Dr Michael F Platten
 
I must say Mickey.....you are good at what you do ...

Thanks a million
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top