confusion regarding Matrix dimension.

1 vue (au cours des 30 derniers jours)
Bhavik
Bhavik le 20 Jan 2015
Commenté : Ced le 21 Jan 2015
Hello,
I have a B matrix in my model having a size of 5x5. I want to multiply B matrix with S matrix which is 5x6. So I am assuming an additional raw in matrix B as [ 0 0 0 0 0]. This way my Matrix B will be 6x5 and I am doing S*B.
Is this the right method? Am I doing right or wrong? Can I assume a null raw? Please help me.
  3 commentaires
Bhavik
Bhavik le 21 Jan 2015
Thank you Ced, I really appreciate your interest.
Smatrix = [ S11 S12 0 0 0; S21 S22 0 0 0; S31 -S31 0 0 0; 0 0 1 0 0; 0 0 0 1 0; 0 0 0 0 1];
Bmatrix = [B11 B12 0 0 0; B21 B22 0 0 0; 0 0 1 0 0; 0 0 0 1 0; 0 0 0 0 1];
---------------------- Mbar = (Smatrix.'*Mmatrix)*Smatrix;
Vbar = Smatrix.'*(Vvector + Mmatrix*Sdotmatrix*v);
Gbar = Smatrix.'*Ggravity;
Bbar = Smatrix.'*Bmatrix;
I am finding vdot by the following equation:
vdot = (Mbar)/(Bbar*u - Vbar - Gbar);
Where, Mbar is 6x6, Vbar and G bar are 5x1 and Bbar should be 5x1. I have B matrix 5x5 to get Bbar 5x1, B matrix must be 6x5. But I have data in which B matrix is 5x5. So I assumed B matrix as 6x5 (Taking the last raw as [0 0 0 0 0]). Is this the right way I am doing?
Ced
Ced le 21 Jan 2015
I'm sorry, I have no idea what the actual question is. But if Smatrix and Bmatrix are 6x5, then Smatrix'.*Bmatrix is not going to work, no matter if Bmatrix is 5x5 or 6x5, since Smatrix' and Bmatrix need to have the same number of elements.
I think Stephen Cobeldick is correct: You need to have a look at the difference between matrix multiplication S*B and element-wise multiplication S.*B.

Connectez-vous pour commenter.

Réponses (1)

Stephen23
Stephen23 le 20 Jan 2015
You might want to read about the difference between matrix and array multiplication.
Try this:
S.*B

Catégories

En savoir plus sur Mathematics dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by