Effacer les filtres
Effacer les filtres

Square Matrix multiplication for n-number function handles

1 vue (au cours des 30 derniers jours)
Georgios Koutsakis
Georgios Koutsakis le 4 Oct 2019
Hello,
The picture attached defines cleary the proposed problem.
TransferMatrixperLayer{1,1} = @(s,i) s+i;
TransferMatrixperLayer{1,2} = @(s,i) s+2*i;
TransferMatrixperLayer{2,1} = @(s,i) s+3*i;
TransferMatrixperLayer{2,2} = @(s,i) s+4*i;
The TransferMatrixperLayer is a cell array 2x2 function handle. The i defines the number of each individual TransferMatrixperLayer and s is the function argument. I would like to multiply any number of 2x2 matrices and result to an overall 2x2 matrix where is it going to be a function handle of s.
Long story short: How to do a matrix multiplication of a 2x2 function handle (as a function of s) matrix for i=1:N where for example N=3.
Tried to do it like the proposed method, but it doesn't work.
% This part of the code doesn't work.
TransferMatrix=@(s) TransferMatrixperLayer(s,1);
for i = 2:N
TransferMatrix=@(s) TransferMatrix(s) .* TransferMatrixperLayer(s,i);
end
The following is expected to be the final result.
A=@(s) TransferMatrix{1,1};
B=@(s) TransferMatrix{1,2};
C=@(s) TransferMatrix{2,1};
D=@(s) TransferMatrix{2,2};
Thanks,
George Koutsakis

Réponses (1)

SaiDileep Kola
SaiDileep Kola le 26 Mar 2021
Check solution proposed for similar question here

Catégories

En savoir plus sur Creating and Concatenating Matrices dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by