Spectral radius of 4×4 matrices

15 views (last 30 days)
Sunday Aloke
Sunday Aloke on 17 Apr 2025
Edited: Torsten on 17 Apr 2025

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

Accepted Answer

Paul
Paul on 17 Apr 2025
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 Comments
Sunday Aloke
Sunday Aloke on 17 Apr 2025

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

Torsten
Torsten on 17 Apr 2025
Edited: Torsten on 17 Apr 2025
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.

Sign in to comment.

More Answers (0)

Categories

Find more on Generating Code in Help Center and File Exchange

Tags

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!