How to perform matrix pencil operations on matlab? Is there a toolbox or a function?

26 visualizaciones (últimos 30 días)
I need to perform matrix pencil operations but unable to find any function or toolbox that performs the same. Please help.

Respuestas (2)

Ced
Ced el 16 de Mzo. de 2016
Editada: Ced el 16 de Mzo. de 2016
Do you just need to evaluate a matrix pencil? You can just write your own little function.
Let's say you want to compute the pencil of degree l. This is one possible way of about doing it:
1. save the l+1 matrices in a big 3D matrix.
2. multiply each "plane" i (3rd dimension) with one pencil weight lambda i
3. sum it all up
Note: A more efficient way to do this would be to stack the matrices in columns (i.e. stay in 2D rather than 3D). If speed is not an issue, then I find the 3D version "safer" and clearer, but that's a personal choice.
Little dummy example:
Let's say l = 2 and A0,A1,A2 are nxn matrices. lambda is an (l+1)x1 vector.
M3D = cat(3,A0,A1,A2); % stack in 3rd dimension
% iterative way:
pencil_it = zeros(n,n);
for i = 1:l+1
pencil_it = pencil_it + lambda(i)*M3D(:,:,i);
end
% direct way:
% turn lambda in 3rd dimension, adjust it to size of matrices, multiply, sum up
pencil_direct = sum(M3D.*repmat(permute(lambda,2,3,1),n,n),3);
EDIT: Forgot to say:
The lambda vector can easily be obtained from your lambda weight by
lambda = lambda_weight.^(0:l)';

Matthew Wade
Matthew Wade el 1 de Ag. de 2020
Editada: Matthew Wade el 1 de Ag. de 2020
Typo in direct solution:
pencil_direct = sum(M3D.*repmat(permute(lambda,2,3,1),n,n),3);
should be square brackets in second argument for permute
pencil_direct = sum(M3D.*repmat(permute(lambda,[2,3,1]),n,n),3);

Categorías

Más información sobre Linear Algebra en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by