0
votes

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:

enter image description here

enter image description here

Element in S(the value set of a function)

enter image description here

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
1
Try the cell2mat function (see MATLAB help page for details)hbaderts
@hbaderts the content of each element is the value of a function i.e(results). So I'm afraid it cannot be converted into matrix.cqcn1991
It would be better if you printed the values in the command window and pasted those as text rather than pasting screen shots.kkuilla
I'm getting a bit lost I'm afraid. I think your question contradicts itself. You first say that you want to calculate R*S*R' but in your last statement you say that you want to calculate R(1,1) * S(1,1) + R(1,2) * S(2,1) ... What are you trying to do? In case of R*S*R', the matrix dimensions will mismatch. It will be 26x1 2049x1 1x26.kkuilla
@kkuilla, you maybe mistake the element of the S as the S matrix itself. The 2049*1 is just in one cell of the matrix S. S is 6*6.cqcn1991

1 Answers

1
votes

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)