Borrar filtros
Borrar filtros

Square Matrix multiplication for n-number function handles

1 visualización (últimos 30 días)
Georgios Koutsakis
Georgios Koutsakis el 4 de Oct. de 2019
Respondida: SaiDileep Kola el 26 de Mzo. de 2021
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

Respuestas (1)

SaiDileep Kola
SaiDileep Kola el 26 de Mzo. de 2021
Check solution proposed for similar question here

Categorías

Más información sobre Creating and Concatenating Matrices 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