필터 지우기
필터 지우기

Create a matrix of element (points) connectivity

조회 수: 7 (최근 30일)
sci hub
sci hub 2021년 7월 5일
편집: sci hub 2021년 7월 6일
Hiii
I am new to matlab, trying to create a 2D rectangular boxs with number of points as attached, with number of rectangular boxes
I also attached the code (it's only with 4 points) I would like to know how to make it with 9 points... or 16 points ?
clear all;
clc;
m=2; % m : number of points in x direction in each rectangular box
n=2; % n : number of points in y direction in each rectangular box
% Numbering
nel = m*n; % total number of elements (total number of rectangular box
elem = zeros(nel,9); % matrix of element connectivities
for I = 1:m
for J = 1:n
elem_num = J + (I-1)*n; % element counter
elem(elem_num,1) = J + (I-1)*(n+1); % node 1 % SHOULD ADD UNTIL NODE 9
elem(elem_num,2) = elem(elem_num,1) + (n+1); % node 2
elem(elem_num,3) = elem(elem_num,2) + 1; % node 3
elem(elem_num,4) = elem(elem_num,1) + 1; % node 4
% elem(elem_num,5) =; % node 5
%elem(elem_num,6) = ; % node 6
% elem(elem_num,7) = ; % node 7
% elem(elem_num,8) = ; % node 8
% elem(elem_num,9) = ; % node 9
end
end
% I would like to obtain elem =[1 3 4 2 5 6 7 8 9;3 10 11 4 12 13 14 6 15]

답변 (1개)

Yongjian Feng
Yongjian Feng 2021년 7월 5일
Can you just change
m=3;
n=3;
for 9 ponts?
  댓글 수: 1
sci hub
sci hub 2021년 7월 5일
Thank you for your reply. But I did not mean that..
m and n are the elements number
not the points.. as attached
I would like to obtain elem =[1 3 4 2 5 6 7 8 9;3 10 11 4 12 13 14 6 15]
Hope you get what I meant ??

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by