Display a matrix in terms of other matrices

1 Ansicht (letzte 30 Tage)
Salman
Salman am 28 Jul. 2014
Kommentiert: Azzi Abdelmalek am 28 Jul. 2014
Hello,
I have a 5x5 matrix A and a large matrix containing say B = [A;A^2;A^3.....A^n]. I want to display this B matrix in form of A's. If I print B, it gives me a large matrix with numbers in it. I want it to be displayed in terms of A, A^2, A^3 and so on.
How can I do that in matlab?
Thank you, Salman Hafeez

Antworten (1)

Azzi Abdelmalek
Azzi Abdelmalek am 28 Jul. 2014
n=10
B =['[' sprintf( 'A^%d ',1:n) ']']
  2 Kommentare
Salman
Salman am 28 Jul. 2014
Thank you for your answer. Actually, I am using a state space model in which I have A,B,C,D matrices. I am performing operations on these matrices and generating other matrices say
X = [A;A^2;A^3...A^n]
Y = [B 0 0...0;AB B 0...0;A^2*B AB B...0]
Similar matrices are being generated by using C and D. Is there a way that, knowing the contents of A,B,C and D, Matlab can automatically display the contents of X and Y in terms of A and B?
Thank you
Azzi Abdelmalek
Azzi Abdelmalek am 28 Jul. 2014
You can use symbolic variables
syms A B C D
X = [A A^2 A^3]

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by