cellEig

Below is a demonstration of the features of the cellEig function

Contents

Syntax

[V,D]=cellEig(C);

Description

Computes eigenvalues and eigenvectors for each matrix contained in the cell array C, i.e. [v,d]=eig(c) is executed for each cell entry. The output is two cell arrays, i.e. the cell V containing the eigenvectors and the cell D containing the eigenvalues.

Examples

clear; close all; clc;

Example: Calculating eigenvalues for matrices contained in cells

Creating example cell containing two matrices

M1=rand(3,3);
M1=M1*M1';
M2=rand(5,5);
M2=M2*M2';

C={M1,M2};
[V,D]=cellEig(C);

Contained in the output cells are the eigenvectors and eigenvalues of each of the matrices e.g. for the first

v1=V{1}
d1=D{1}
v1 =

   -0.1497   -0.6967    0.7016
    0.8045    0.3267    0.4960
   -0.5748    0.6387    0.5116


d1 =

    0.0000         0         0
         0    0.1949         0
         0         0    2.7379

and the second entry

v2=V{2}
d2=D{2}
v2 =

    0.3454    0.5676    0.5757   -0.0123    0.4764
   -0.1318    0.2593   -0.3317    0.8725    0.2099
    0.5226   -0.6219   -0.1595    0.0692    0.5567
   -0.1565    0.3706   -0.6433   -0.4834    0.4367
   -0.7522   -0.2940    0.3455   -0.0099    0.4779


d2 =

    0.0124         0         0         0         0
         0    0.1209         0         0         0
         0         0    0.3154         0         0
         0         0         0    0.6369         0
         0         0         0         0    8.4207

GIBBON www.gibboncode.org

Kevin Mattheus Moerman, [email protected]