how do i multiply n number of matrix for 2x2 with the symboic output

2 vues (au cours des 30 derniers jours)
grace lim
grace lim le 20 Fév 2022
Commenté : Walter Roberson le 21 Fév 2022
hi how do i use my symbolc output results and do a matrix multiplication for a 2x2 matrix?thank you in advance
  5 commentaires
grace lim
grace lim le 20 Fév 2022
Modifié(e) : grace lim le 20 Fév 2022
im usng symbolic to simplify symbols ,theres error,'M ' is not a variable
is there another way to solve?
what does M means?
Walter Roberson
Walter Roberson le 20 Fév 2022
M is the 2x2 matrix that you want to multiply by.
Maybe you want
E = ABCD
for n=1:9
E = E*ABCD;
end

Connectez-vous pour commenter.

Réponses (2)

grace lim
grace lim le 20 Fév 2022
i tried this way but there is no output
E = ABCD
for n=1:9
E = E*ABCD;
end
  1 commentaire
Walter Roberson
Walter Roberson le 20 Fév 2022
I am not going to type in your equations from your image, so I will illustrate with some examples:
syms h0 h1 h2 h3
A = 1/(h0+h1)
A = 
B = h0/(h0+h2)
B = 
C = h2*h3/h0
C = 
D = h3 - h1
D = 
ABCD = [A B; C D]
ABCD = 
E = ABCD
E = 
for n = 1:9
E = E*ABCD;
end
E
E = 
If you need to see the results of each multiplication in turn, then change E = E*ABCD; to become E = E*ABCD without the semi-colon

Connectez-vous pour commenter.


grace lim
grace lim le 21 Fév 2022
thank you,
how about if i wnt to do 2 matrix multiplication for n number of times?
do i do it this way?
E=[A B;CD]
F={A B;C D]
EF=E*F
for n = 1:9
E = E*ABCD;
end
  3 commentaires
grace lim
grace lim le 21 Fév 2022
sorry ,what i meant was:
syms ....
h11..
h12..
h21...
h22...
E=[A B;C D]
...
F=[A B;C D]
..
EF=E*F
the 2 matrix ABCD are different
then,
for n = 1:9
E = E*ABCD;
end
Walter Roberson
Walter Roberson le 21 Fév 2022
How does ABCD differ from the [A B;C D] you assign to E, and how does that differ from the [A B;C D] that you assign to F?
Or are you changing A B C D between those points?
Anyhow... go ahead with your code. Just make sure you get right how many multiplications you want to do.
If we call the new A B C D as nA, nB, nC, nD then do you want [nA, nB; nC, nD] * ABCD^9 or do you want [nA, nB; nC, nD] * ABCD^10 ? Your current code would give [nA, nB; nC, nD] * ABCD^9 . In the special case where nA, nB, nC, nD are the same as A, B, C, D, then nA, nB; nC, nD] * ABCD^9 would be the same as ABCD^10

Connectez-vous pour commenter.

Catégories

En savoir plus sur Logical 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