Scilab Program to find Eigenvalues and Eigenvectors

Scilab has inbuilt function named spec() to calculate the eigenvalues of a matrix. It takes exactly one argument which is a matrix. To find eigenvalues of matrix A we need to execute spec(A) command. spec() command is used to find eigenvalues of a matrix A in scilab.

This program finds eigenvalues and eigenvectors of 3 matrices. The program output is also shown below. Here is the scilab program on how to find eigenvalues and eigen vectors in scilab.

Scilab code to find eigenvalues and eigenvectors

/* Aim: Scilab program to find eigenvalues and eigenfunctions */

X=[4,5,7;2,1,3;1,2,3];
Y=[1,-%i,1+4*%i;%i,3,2;3-4*%i,4,2];
Z=[2,-%i,1*%i;%i,2,4;-4*%i,2,5];
[c,d]=spec(X);
[e,f]=spec(Y);
[g,h]=spec(Z);
disp(spec(X),"The Eigen-values of matrix X are:");
disp(c,"The Eigen-vectors of matrix X is:");
disp(spec(Y),"The Eigen-values of matrix Y are:");
disp(e,"The Eigen-vectors of matrix Y is:");
disp(spec(Z),"The Eigen-values of matrix Z are:");
disp(g,"The Eigen-vectors of matrix Z is:");

Output:

 The Eigen-values of matrix X are:   
    8.3914676  
    0.6722084  
  - 1.0636761  
 The Eigen-vectors of matrix X is:   
  - 0.8842186  - 0.7926444    0.3991703  
  - 0.3600242  - 0.2505817  - 0.8577500  
  - 0.2975567    0.5558091    0.3239259  
 The Eigen-values of matrix Y are:   
  - 3.9621223 - 0.7485297i  
    6.6859632 + 0.7572081i  
    3.2761591 - 0.0086784i  
 The Eigen-vectors of matrix Y is:   
  - 0.2457663 - 0.5924552i    0.2032226 + 0.4812499i  - 0.4171226 - 0.4684274i  
  - 0.2821217 + 0.0656327i    0.3009483 - 0.0066897i    0.7395716               
    0.7104192                 0.7977998               - 0.1320940 + 0.2053522i  
 The Eigen-values of matrix Z are:   
  - 1.1757477 - 1.481D-16i  
    3.378386 - 2.799D-16i   
    6.7973617 - 2.382D-16i  
 The Eigen-vectors of matrix Z is:   
    1.227D-17 + 0.4000085i    6.460D-17 - 0.4949540i  - 2.791D-17 + 0.0279109i  
    0.7638664                 0.8521455                 0.6367042 - 1.719D-16i  
  - 0.5064596 + 1.404D-17i    0.1699078 + 9.765D-17i    0.7706028