Effacer les filtres
Effacer les filtres

Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

How can I create this matrix?

2 vues (au cours des 30 derniers jours)
ghazwan alsoufi
ghazwan alsoufi le 11 Déc 2014
Clôturé : MATLAB Answer Bot le 20 Août 2021
I would like to create a matrix in Matlab. I have variable Y(i,j,k) where
i=0,1,2,...,v j=1,2,...,v+1 and q=1,2,...,Q
also
i~=j (i not equal j)
for example when v=2 and q=2 the matrix will be
[1 1 0 0 0 0 1 1 0 0 0 0;
0 0 1 1 1 1 0 0 0 0 0 0 ]
when v=2 and q=3 the matrix will be
[1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0;
0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0]
when v=3 and q=2 the matrix will be
[1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0;
0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0;
0 0 0 0 1 1 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0]
Note that the size of matrix is (v,2*(q*v)+q*(v*(v-1))). Can you help me please to create this matrix for any number of v and q?
Regards,
Ghazwan.
  2 commentaires
Image Analyst
Image Analyst le 11 Déc 2014
In "variable Y(i,j,k)" where is q? And in your examples, you show 2D matrices, yet Y is a 3D array. What matrix are you showing?
Guillaume
Guillaume le 11 Déc 2014
It's certainly very unclear how the matrices are generated. v appear to be the number of rows and q the number of repeated columns. How the 1 appear in there and what i, j, k have to do with it is not explained.

Réponses (0)

Cette question est clôturée.

Tags

Aucun tag saisi pour le moment.

Community Treasure Hunt

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

Start Hunting!

Translated by