Azzera filtri
Azzera filtri

Create a matrix of element (points) connectivity

7 visualizzazioni (ultimi 30 giorni)
sci hub
sci hub il 5 Lug 2021
Modificato: sci hub il 6 Lug 2021
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]

Risposte (1)

Yongjian Feng
Yongjian Feng il 5 Lug 2021
Can you just change
m=3;
n=3;
for 9 ponts?
  1 Commento
sci hub
sci hub il 5 Lug 2021
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 ??

Accedi per commentare.

Categorie

Scopri di più su Multidimensional Arrays in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by