Spectral radius of 4×4 matrices

조회 수: 7 (최근 30일)
Sunday Aloke
Sunday Aloke 2025년 4월 17일
편집: Torsten 2025년 4월 17일

I want to find the Spectra redius of the matrices below but I kept running into problem. syms a b c d e f g F = [0 0 0 a; 0 0 0 b; 0 0 0 c; e f g 0]

syms q r s t u V = [q 0 0 0; r s 0 0; 0 0 t 0; 0 0 0 u]

Vi = inv(V) % calculate inverse of V

K = F*Vi % compute the next generation matrix

 eigenvalues= eig(K) % Find the eigenvalues of \(K\)

abs_eigenvalues = abs(eigenvalues) % Compute the absolute values of the eigenvalues.

spectral_radius = max(abs_eigenvalues) %Find the maximum absolute eigenvalue. Error It's show fatal error

채택된 답변

Paul
Paul 2025년 4월 17일
Hi Sunday,
The code runs without error (after defining h) here on Answers using 2024b. You're seeing a different result in 2021a?
syms a b c d e f g h % have to define h
F = [0 0 0 a; 0 0 0 b; 0 0 0 c; e f g h]
F = 
syms q r s t u
V = [q 0 0 0; r s 0 0; 0 0 t 0; 0 0 0 u]
V = 
Vi = inv(V) % calculate inverse of V
Vi = 
K = F*Vi % compute the next generation matrix
K = 
eigenvalues= eig(K) % Find the eigenvalues of \(K\)
eigenvalues = 
abs_eigenvalues = abs(eigenvalues) % Compute the absolute values of the eigenvalues.
abs_eigenvalues = 
spectral_radius = max(abs_eigenvalues) %Find the maximum absolute eigenvalue. Error It's show fatal error
spectral_radius = 
  댓글 수: 2
Sunday Aloke
Sunday Aloke 2025년 4월 17일

Thank you. There no h in the F-matrix.

Torsten
Torsten 2025년 4월 17일
편집: Torsten 2025년 4월 17일
There no h in the F-matrix.
The code also works under R2024b if you replace h by 0 in the F-matrix.
Or you could use
spectral_radius = subs(spectral_radius,h,0)
as last command in the code from above.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Generating Code에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by