Create a generic matrix array (coordinates ) based on input data in a specific direction as attached in the photo
이전 댓글 표시
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
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!