行列A(3000行364列)と行列B(364行1列)があります。28×13=364
基本は,Aのn列目のデータ全てに,A列のn列目と同じ数字のBのn行目のデータを掛け算したいというものです。
ここからが面倒なのですが,
Aを28列を1グループとして,それを更に以下のように4分割して,計算を繰返し13回行いたいですがやり方がいまいちピンときません。
A28列目×sin45°×B28行目+A1~6列目×B1~6行目+A7列目×sin45°×B7行目,A7列目×cos45°×B7行目+A8~13列目×B8~13行目+A14列目×cos45°×B14行目,A14列目×sin45°×B14行目+A15~20列目×B15~20行目+A21列目×sin45°×B21行目,A21列目×cos45°×B21行目+A22~27列目×B22~27行目+A28列目×cos45°×B28行目
最終的には,行列C(3000行4×13=52列)を作りたいです。
拙い説明で大変申し訳ありません。お手数ですが,ご不明な点は聞いてください。
よろしくお願いいたします。

2 commentaires

Dyuman Joshi
Dyuman Joshi le 11 Avr 2024
How is your question related to MATLAB?
As of now, this is more related to Excel and not MATLAB.
かお
かお le 11 Avr 2024
この計算の前後にもパワースペクトル密度を出すなどのいろんな作業があるのですが,この部分だけどうしたらいいのか分からなかったため,質問をいたしました。

Connectez-vous pour commenter.

 Réponse acceptée

0 votes

A = rand(3000, 364);
B = rand(364, 1);
C = zeros(3000, 52);
for i = 1 : 4 : 13
j = (i - 1) * 28;
C(:,i) = (A(:,j+28) .* sind(45) .* B(j+28)) + ...
(A(:,j+8:13) * B(j+8:13)) + ... ここの要素は内積?
(A(:,j+7) .* sind(45) .* B(j+7));
C(:,i+1) = (A(:,j+7) .* cosd(45) .* B(j+7)) + ...
(A(:,j+1:6) * B(j+1:6)) + ...
(A(:,j+14) .* cosd(45) .* B(j+14));
C(:,i+2) = (A(:,j+14) .* sind(45) .* B(j+14)) + ...
(A(:,j+15:20) * B(j+15:20)) + ...
(A(:,j+21) .* sind(45) .* B(j+21));
C(:,i+3) = (A(:,j+21) .* cosd(45) .* B(j+21)) + ...
(A(:,j+22:27) * B(j+22:27)) + ...
(A(:,j+28) .* cosd(45) .* B(j+28));
end

1 commentaire

かお
かお le 14 Avr 2024
なるほど。参考になりました!
ありがとうございます。

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!