Spectral radius of 4×4 matrices

6 次查看(过去 30 天)

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