Eigenvalues and Eigenvectors in SCILAB

Scilab has an inbuilt function called spec(A) to calculate the Eigenvalues of a Matrix A.
If you type,
[c,d]=spec(A)
where d is a diagonal matrix which contains the eigen-values,
and c is a matrix that stores the eigen-vectors as it’s columns.

The following code illustrates the use of the function spec(A) to print the eigenvalues and eigenvectors of Matrices.

//Eigenvalues and Eigenfunctions
clc;
A=[2,1,1;1,3,2;3,1,4];
B=[1,-%i,3+4*%i;%i,2,4;3-4*%i,4,3];
C=[2,-%i,2*%i;%i,4,3;-2*%i,3,5];
[c,d]=spec(A);
[e,f]=spec(B);
[g,h]=spec(C);
disp(spec(A),"The Eigen-values of matrix A are:");
disp(c,"The corresponding Eigen-vectors of matrix A is:");
disp(spec(B),"The Eigen-values of matrix B are:");
disp(e,"The corresponding Eigen-vectors of matrix B is:");
disp(spec(C),"The Eigen-values of matrix C are:");
disp(g,"The corresponding Eigen-vectors of matrix C is:");

Output:

123

Video:

PhD researcher at Friedrich-Schiller University Jena, Germany. I'm a physicist specializing in theoretical, computational and experimental condensed matter physics. I like to develop Physics related apps and softwares from time to time. Can code in most of the popular languages. Like to share my knowledge in Physics and applications using this Blog and a YouTube channel.



One thought on “Eigenvalues and Eigenvectors in SCILAB

Leave a Reply

Your email address will not be published. Required fields are marked *