Random perturbed uniform mesh in Matlab....
Random perturbed uniform mesh in Matlab....
(OP)
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
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





RE: Random perturbed uniform mesh in Matlab....
A little more information would be useful
M
--
Dr Michael F Platten
RE: Random perturbed uniform mesh in Matlab....
Tony
RE: Random perturbed uniform mesh in Matlab....
CODE
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');
--
Dr Michael F Platten
RE: Random perturbed uniform mesh in Matlab....
Thanks a million