フィルターのクリア

Perform minimization w.r.t. scalar on product of Cell arrays

1 回表示 (過去 30 日間)
Oliver
Oliver 2022 年 12 月 6 日
回答済み: Rangesh 2023 年 12 月 28 日
I need to minimize this expression with respect to :
For clarification: is a 4x4 unitary matrix, the part in the middle represents a block diagonal matrix. Its block elements are a 2x2 identity matrix with values scaled by the function . x is a 2x1 vector with known inputs so is evaluated twice.
lambdaA = cell(4, 4);
%fill Blockmatrix lambdaA:
% 0 function handle on off diagonal, function s, on diagonal elements
for i = 1:numel(x)
for j = 1:numel(x)
if j~=i
lambdaA{i,j} = @(s) 0*s;
elseif j == i
lambdaA{i,j} = @(s)((x(i) + 1)^s + (x(i)-1)^s) / ((x(i) + 1)^s - (x(i)-1)^s);
end
end
end
I have implemented the block diagonal matrix in the middle using a cell array filled with function handles. That is, on its diagonal elements it has a function handle for = @(s) (x+1)^s + ..., and on its off diagonal it has function handles that always return zero, i.e. @(s) 0*s.
In accordance, the matrix is also represented by a 4x4 cell array with its cells being the matrix elements.
%the matrix SA is passed as input to the function, the loop makes a cell array out of it
SA_Cell = cell(4,4);
SB_Cell = cell(4,4);
for i=1:4
for j=1:4
SA_Cell{i,j}= SA(i,j);
end
end
So overall the matrix looks like:
%initialize Covariance matrix cell
V = cell(4,4);
%find s such that function handles in lambdaA is minimal using fmindbnd
sminA = [fminbnd(lambdaA{1,1}, 0, 1) fminbnd(lambdaA{1,1}, 0, 1) fminbnd(lambdaA{3,3}, 0, 1) fminbnd(lambdaA{3,3}, 0, 1)];
%VA = S*lambdaA*S', with minimum lambda
for i=1:4
for j=1:4
V{i,j} = SA_Cell{i,j}*lambdaA{i,j}(sminA(i))*SA_Cell{j,i};
end
end
The issue is: I can only evaluate the expression for a given input , in the code above I have simply minimized the function handles in the block matrix and used that as input, i.e. lambdaA{i,j}(sminA(i)), where sminA is a vector containing the minimized for the input vector in .
However I wish to minimize over the product of cell arrays such that the matrix V is minimized w.r.t. some matrix norm: so I don't want to input some values for s, but I wish to find the value as a result of minimizing the product of cell arrays.
Any help is appreciated.

回答 (1 件)

Rangesh
Rangesh 2023 年 12 月 28 日
Hello Oliver,
I understand that you want to optimize the entire matrix rather than evaluating individual elements within it.
Let's consider an optimization problem involves minimizing the Frobenius norm (which is the square root of the sum of the absolute squares of the matrix elements). The mathematical representation of this optimization problem is:
Minimization of the function over the variable s, with the objective function as
fminbnd(@minV,0,1)
ans = 0.7595
Here, the function “minV” return value of the forbenius norm of the matrix
function [V]= minV(s)
x=[ 1 2];
% random generation of matrix instead of unitary matrix
SA=rand(4);
V=zeros(4);
lambda=zeros(4);
for i = 1:numel(x)
for j = 1:numel(x)
if j == i
lambda(i,j) =((x(i) + 1)^s + (x(i)-1)^s) / ((x(i) + 1)^s - (x(i)-1)^s);
end
end
end
%Product of matrices to obtain V(s)
V=SA*lambda*transpose(SA);
% Norm taken here is forbenius norm of the matrix
V=norm(V);
end
I hope the above approach resolves your query by considering the minimization of function over some matrix norm.
For further understanding on the function used, please do refer the following documentation:

カテゴリ

Help Center および File ExchangeOperating on Diagonal Matrices についてさらに検索

製品


リリース

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by