Effacer les filtres
Effacer les filtres

matrix in special arrangment for cycler gemetry

2 vues (au cours des 30 derniers jours)
mohammed hussein
mohammed hussein le 27 Fév 2021
Commenté : mohammed hussein le 27 Fév 2021
hello every one
thank you very much for helping
i have big matrix for motor geometry i want to make special arrangement to respect complete circle of motor
for example i have this small matrix
A=[11 12 13 14 15]
i want to change it to
A=[11 12 13 14 15
12 11 12 13 14
13 12 11 12 13
14 13 12 11 12
15 14 13 12 11]
thank you very much again for helping
  2 commentaires
Shreesha Subrahmanya
Shreesha Subrahmanya le 27 Fév 2021
hi hussein,
please try below code. it will help. let me know if it worked for you :)
A =[11 12 13 14 15];
B =zeros(length(A))
for n = 1:length(A)
B(n,n:end)= A(1,1:end-(n-1))
end
V = B+B'- (diag(ones(1,length(A)))*A(1))
mohammed hussein
mohammed hussein le 27 Fév 2021
Modifié(e) : mohammed hussein le 27 Fév 2021
Thank you very much , it works perfectly
is there any way to get it without for loop , i have very long matrix it takes very long time

Connectez-vous pour commenter.

Réponse acceptée

Bruno Luong
Bruno Luong le 27 Fév 2021
Modifié(e) : Bruno Luong le 27 Fév 2021
>> A=[11 12 13 14 15]
A =
11 12 13 14 15
>> toeplitz(A,A)
ans =
11 12 13 14 15
12 11 12 13 14
13 12 11 12 13
14 13 12 11 12
15 14 13 12 11

Plus de réponses (0)

Catégories

En savoir plus sur Matrix Indexing dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by