Calculating Eigenvalues w/ MATLAB: Defining Variables k,α,β,γ

  • Context: MATLAB 
  • Thread starter Thread starter quansnow
  • Start date Start date
  • Tags Tags
    Eigenvalues Matlab
Click For Summary
SUMMARY

The discussion focuses on calculating eigenvalues in MATLAB using the command eig(A) for a matrix defined with symbolic variables k, α, β, and γ. The user encountered an error stating "Undefined function or variable 'k'." The solution provided involves using the syms command, which is a shortcut for the sym() function to define symbolic variables in MATLAB. This approach successfully resolves the issue, allowing for the calculation of eigenvalues without further errors.

PREREQUISITES
  • Familiarity with MATLAB programming environment
  • Understanding of symbolic mathematics in MATLAB
  • Knowledge of eigenvalues and eigenvectors
  • Basic matrix operations in linear algebra
NEXT STEPS
  • Learn how to use the syms command in MATLAB for defining symbolic variables
  • Explore the eig() function in MATLAB for eigenvalue calculations
  • Study the MATLAB Symbolic Math Toolbox
  • Investigate advanced matrix operations and their applications in MATLAB
USEFUL FOR

Mathematics students, engineers, and researchers who need to perform symbolic calculations and eigenvalue analysis in MATLAB.

quansnow
Messages
3
Reaction score
0
I use the command eig(A) to calculate the eigenvalues of the matrix A, in which k,α,β,γ are variables,

A=[-0.5*k -i*α 0;-i*α -0.5*γ -i*β;0 i*β -0.5k];
eig(A)

but the MATLAB shows "Undefined function or variable 'k'."
I don't know how to define the variables k,α,β,γ.
Can anyone tell me how to do it? Thanks!
 
Physics news on Phys.org
It works. Thanks a lot!
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 7 ·
Replies
7
Views
2K
  • · Replies 18 ·
Replies
18
Views
2K
  • · Replies 44 ·
2
Replies
44
Views
7K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
5K
  • · Replies 4 ·
Replies
4
Views
4K