フィルターのクリア

Creating an array of arrays

1 回表示 (過去 30 日間)
Chris Stillo
Chris Stillo 2020 年 12 月 12 日
回答済み: Chris Stillo 2020 年 12 月 12 日
I am trying to generalize creating a 2x2 diagonal array using a for loop.
q = [0.2 0.4]; %2 possible values for process noise variance
Qc1 = diag([q(1) q(1)]); %-> 2x2 matrix
Qc2 = diag([q(2) q(2)]); % -> another 2x2 matrix
Qcm = ???
for i=1:length(q)
Qcm(i) = diag([q(i) q(i)]);
end
My question is what is the correct way to initialize Qcm?

採用された回答

Chris Stillo
Chris Stillo 2020 年 12 月 12 日
Use a structure array. Doh!
I'll give myself qudos

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by