フィルターのクリア

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 Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by