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

26 次查看(过去 30 天)
I need to perform matrix pencil operations but unable to find any function or toolbox that performs the same. Please help.

回答(2 个)

Ced
Ced 2016-3-16
编辑:Ced 2016-3-16
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 2020-8-1
编辑:Matthew Wade 2020-8-1
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);

类别

Help CenterFile Exchange 中查找有关 Linear Algebra 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by