Reputation: 21573
I need to calculation R*S*R'
.
R
is an ordinary matrix.
But S
is composed of values. The element of S
is the value of F(w)
, and is calculated by
[PressureSpecAuto,F] = periodogram(....);
S{i,j} = PressureSpecAuto;
which means each element is a set of data.
The problem is that, Matlab cannot multiply cell matrix with matrix, then How can I solve this problem?
Notice: The element of S
should not be treated as an vector. It's just the value set of function F(w).
UPDATE1:
Element in S(the value set of a function)
Essentially, element in S
is a function's value, e.g. f(x)
. When multiplying, it is still R(1,:)*S(:,1). That is, R(1,1) * S(1,1) + R(1,2) * S(2,1) ...
UPDATE2:
R:
1 0 0 0 0 0
0 0 0 0 0 0
1 0 0 0 0 0
0 0 0 0 0 0
1 0 0 0 0 0
0 0 0 0 0 0
1 0 0 0 0 0
0 0 0 0 0 0
0 1 0 0 0 0
0 0 0 0 0 0
0 1 0 0 0 0
0 0 0 0 0 0
0 1 0 0 0 0
0 0 0 0 0 0
0 1 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 1 0 0
0 0 0 0 0 0
0 0 1 0 0 0
0 0 0 0 0 0
0 0 0 1 0 0
0 0 0 0 0 0
0 0 0 0 1 0
0 0 0 0 0 0
0 0 0 0 0 1
Element in S( e.g. S(1,1) ):
2.11586339015690e-23
6548.06822760155
10933.4416318101
67974.4878764171
1640.90694018577
22254.1105594943
54583.8668300499
25426.8190829386
4646.70203854458
19224.2485418923
17292.0278726986
928.765041030392
14728.5614115324
113385.034815149
30274.0332077125
22697.8886043178
61916.4030808219
38648.2740539840
127.547928632502
24452.0499691112
12311.1687443994
6627.23433956309
11264.7956369618
7232.97125504007
4120.08127891675
1546.69594235781
22795.2322822644
627.572461904325
9237.43533412019
3433.67898348596
Upvotes: 0
Views: 409
Reputation: 2256
Could you use a loop? Maybe this would work then...
Just use a loop and loop through the indices of S
to extract each matrix. Then do the multiplication.
In essence:
for n=1:numel(S)
R*S{n}*R'
end
or using cellfun where @(x)
is an anonymous function.
cellfun(@(x) R*x*R', S, 'UniformOutput',false)
Upvotes: 1