Create Matrix By Several Matrices These Matrices Have Elements By Equations
Afficher commentaires plus anciens
Create Matrix By Several Matrices These Matrices Have Elements By Equations:
Matrix A = zeros (1728,432), Included Matrices (12,3) puted as Diagonal every element an Equation.
A = [Ax1 Bx1 Cx1 0 0 0 ...; Ay1 By1 Cy1 0 0 0 ....; Ax2 Bx2 Cx2 0 0 0 ...; Ay2 By2 Cy2 0 0 0 ...; ........;Ax12 Bx12 Cx12 0 0 0...; Ay12 By12 Cy12 0 0 0 ...; 0 0 0 Ax1 Bx1 Cx1 0 0 0 ...; 0 0 0 Ay1 By1 Cy1 0 0 0 ... ].
In another word Matrix A = [ Matrix (12*3) Zeros zeros zeros
zeros Matrix (12*3) zeros zeros
zeros zeros Matrix (12*3) zeros ..
... ... ... ... ]
Ax1, Bx1, ..... every element equal equation thier values differes as 288 inputs.
If some one can arrange the loops of matrices and the Main matrix A.
Thanks for any Help
Thanks for any thought
Bashar
5 commentaires
The sizes you give seem to be inconsistent. Given A has size 1728*432 then this requires
>> [1728,432]./[12,3]
ans =
144 144
exactly 144 submatrices to define it. So where does the value of "288" come from?
Not only that, but your example show that each submatrix has size 24x3:
Ax1 Bx1 Cx1 ... ; Ay1 By1 Cy1 ... ;Ax12 Bx12 Cx12 ... ; Ay12 By12 Cy12
because there are 12 rows of "x" values and 12 rows of "y" values, which makes 24 rows in total, not "(12,3)" as you wrote (or "(12*3)" in your example). How do you add 12+12 = 12 ?
If the submatrices actually have size 24*3 (as your example actually shows), then the given size of A is not correct.
bashar halleem
le 20 Mai 2020
Stephen23
le 20 Mai 2020
"I want to know how can I put results of every step of main "for loop" in specific position in a matrrix."
Either use blkdiag (easy) or indexing (complex).
bashar halleem
le 21 Mai 2020
bashar halleem
le 21 Mai 2020
Réponses (1)
Having lots of numbered variables is not a good approach, you should place all of those sub-matrices into one cell array when they are created (this is trivial using indexing), i.e.:
C = {M1,M2,... };
where
M1 = [Ax1,Bx1,Cx1;Ay1,By1,Cy1,...];
etc. Of course you should just use indexing when you create them, and NOT use numbered variable names,
B = blkdiag(C{:});
If there is actually just one submatrix repeated (as your question shows), then you can do this:
C = {M};
B = blkdiag(C{ones(1,144)});
Catégories
En savoir plus sur Resizing and Reshaping Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!