how do i multiply n number of matrix for 2x2 with the symboic output
3 views (last 30 days)
Show older comments


hi how do i use my symbolc output results and do a matrix multiplication for a 2x2 matrix?thank you in advance
5 Comments
Walter Roberson
on 20 Feb 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
Answers (2)
grace lim
on 20 Feb 2022
1 Comment
Walter Roberson
on 20 Feb 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)
B = h0/(h0+h2)
C = h2*h3/h0
D = h3 - h1
ABCD = [A B; C D]
E = ABCD
for n = 1:9
E = E*ABCD;
end
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
grace lim
on 21 Feb 2022
3 Comments
Walter Roberson
on 21 Feb 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
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


