Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

How can I create this matrix?

2 views (last 30 days)
ghazwan alsoufi
ghazwan alsoufi on 11 Dec 2014
Closed: MATLAB Answer Bot on 20 Aug 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 Comments
Image Analyst
Image Analyst on 11 Dec 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 on 11 Dec 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.

Answers (0)

This question is closed.

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!