how can I calculate A^n when n is a symbolic positive integer?
조회 수: 1 (최근 30일)
이전 댓글 표시
A = [1/2,1/2,0,0;1/2,0,1/2,0;1/2,0,0,1/2;0,0,0,1]
syms n positive integer
A^n
This would not work because it got stuck and could never stop.
댓글 수: 0
채택된 답변
Walter Roberson
2023년 1월 24일
편집: Walter Roberson
2023년 1월 24일
syms N positive integer
[V, D] = eig(sym(A))
result = V*diag(diag(D).^N)/V
Note those are the matrix operations * and / not element by element operations
댓글 수: 8
참고 항목
카테고리
Help Center 및 File Exchange에서 Number Theory에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!