Create a generic matrix array (coordinates ) based on input data in a specific direction as attached in the photo
Afficher commentaires plus anciens
Hi guys,
I am a bit new to matlab, tyring to generate generic matrix array coordinates (x,y).. I have tried the following code, but works in the wrong direction,
So can anyone help me .... with modifying the code, or so..
thank you, 

clear all;
clc;
w=1; b=1; m=2; n=2;
dx = w/m; dy = b/n;
tnod = (n+1)*(m+1); % total number of nodes
co = zeros(tnod,3);
for ii = 1:m+1
for jj = 1:n+1
node = jj + (ii-1)*(n+1);
x(ii,jj) = (ii-1)*dx;
y(ii,jj) = (jj-1)*dy;
co(node,1) = x(ii,jj);
co(node,2) = y(ii,jj); % CO not as I want
end
end
% CO result should be the following:
0 0 0
0.5 0 0
1 0 0
1 0.5 0
1 1 0
0.5 1 0
0 1 0
0 0.5 0
0.5 0.5 0
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!