What does C(:,:,i)=[Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44]; signify?

1 回表示 (過去 30 日間)
S Priya
S Priya 2021 年 9 月 1 日
コメント済み: Walter Roberson 2021 年 9 月 1 日
What does C(:,:,i)=[Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44]; signify?

回答 (1 件)

KSSV
KSSV 2021 年 9 月 1 日
C(:,:,i)=[Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44];
In the above C, is 3D matrix initialized as 3*3*p matrix. Each matrix of C, should have a 3x3 matrix. The line says there is a loop (i is the index shown here), for the i'th idex in C, a 3x3 matrix is filled in C. The matrix in RHS is a 3X3 matrix and it's each value is denoted by Q11....Q44, where these values should be either calculated or initilaized.
  2 件のコメント
S Priya
S Priya 2021 年 9 月 1 日
編集済み: S Priya 2021 年 9 月 1 日
Thank you sir.It basically means that...
for i=1:3
C(:,:,1) = [Q11 Q12 Q14;Q12 Q22 Q24;Q14 Q24 Q44]
So, what is the output of
C(:,:,2)=? and C(:,:,3)=?
Walter Roberson
Walter Roberson 2021 年 9 月 1 日
If you only assign to C(:,:,1) inside the for loop, then after the for loop:
  • if C did not exist before the for loop, then C(:,:,2) does not exist
  • if C did exist before the for loop, but its size in the third dimension and all following dimensions was 1 before, then C(:,:,2) does not exist
  • if C did exist before the for loop, and at least one dimension from the third onward was 2 or more, then effectively C gets resized like reshape(C,size(C,1), size(C,2), []) and then (:,:,2) of the result would be extracted

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeMultidimensional Arrays についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by