Spectral radius of 4×4 matrices

20 visualizzazioni (ultimi 30 giorni)
Sunday Aloke
Sunday Aloke il 17 Apr 2025
Modificato: Torsten il 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

Risposta accettata

Paul
Paul il 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 Commenti
Sunday Aloke
Sunday Aloke il 17 Apr 2025

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

Torsten
Torsten il 17 Apr 2025
Modificato: Torsten il 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.

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Generating Code in Help Center e File Exchange

Tag

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by