Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Help with converting indexed computation to matrix multiply

1 回表示 (過去 30 日間)
edward
edward 2016 年 3 月 1 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi there, I'm pretty stuck on converting an indexed computation to a matrix multiply.
I currently have:
Pkjn = zeros(N,1);
A = zeros(N,N);
s = zeros(3,N);
W = zeros(3,N);
n = 0:N-1;
for k=1:N
for j=1:N
Pkjn = cos((k-j)*2*pi*n/N).';
Mk = 3 * s(:,k); %3x1
Mj = 3 * s(:,j); %3x1
A(k,j) = (repmat(Mj.*Mk,1,N).*W * Pkjn ).' * ones(3,1);
end
end
and I'd like to convert the computation of A to a Matrix multiply operation. I've got as far as:
h = dftmtx(N);
a = ctranspose(h)*h;
for cc=1:3
b(:,:,cc)=9*s(cc,:)'*(s(cc,:)).*a;
end
A = sum(b,3)
but I can't seem to get any further. Any helpful suggestions gratefully received!
Thanks, Ed.

回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by