フィルターのクリア

Create a matrix of element (lines) points connectivity

6 ビュー (過去 30 日間)
sci hub
sci hub 2021 年 7 月 1 日
コメント済み: sci hub 2021 年 7 月 1 日
Hi,
I am new to matlab trying to create a matrix as attached in the code below
clear all;
clc
nelments = 3;
nelments_vec = 1:nelments;
npoint = 5;
connect = zeros(nelments,npoint); % INTIALIZE ELEMENT CONNECTIVITY
for i=1:nelments
for j=1:npoint
connect(i,j)=[nelments_vec(i) nelments_vec(i)+1]; % ELEMENT/pointCONNECTIVITY MATRIX I WOULD LIKE TO OBTAIN
end
end
The answer should be
connect =[1 2 3 4 5;
5 6 7 8 9;
9 10 11 12 13]
How could I obtain such matrix with different values of npoint and nelments ???
I wish anyone could help me !!!!

採用された回答

Matt J
Matt J 2021 年 7 月 1 日
編集済み: Matt J 2021 年 7 月 1 日
nelments = 3;
npoint = 5;
connect=(1:npoint) + (npoint-1)*(0:nelments-1).'
connect = 3×5
1 2 3 4 5 5 6 7 8 9 9 10 11 12 13
  1 件のコメント
sci hub
sci hub 2021 年 7 月 1 日
@Matt J seems great, can i draw such line with nodes ??

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by