フィルターのクリア

Matrices with variable dimension

3 ビュー (過去 30 日間)
wissal zaher
wissal zaher 2022 年 9 月 6 日
コメント済み: Matt J 2022 年 9 月 6 日
Hey guys,
I need to create two Matrices Q_tilde and B_tilde with variable dimensions depending on a given N (can be any natural number) as follow :
As a beginner who's still learning about MATLAB, I'm struggling a bit on how to do so and would really appreciate any help.
  2 件のコメント
Torsten
Torsten 2022 年 9 月 6 日
編集済み: Torsten 2022 年 9 月 6 日
What are n and m ? From your handwritten script, I assume n = 2 and m = 1. Or do you want to keep these values also variable depending on the dimensions of A and B ?
wissal zaher
wissal zaher 2022 年 9 月 6 日
n = 2 and m = 1 because the B Matrix remains constant.

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

採用された回答

Matt J
Matt J 2022 年 9 月 6 日
編集済み: Matt J 2022 年 9 月 6 日
A=[1,0.1;0 1];
B=[0.005;0.1];
[n,m]=size(B);
z=zeros(n,m);
C=repmat({z},N+1,1);
C{2}=B;
for i=3:N+1
C{i}=A*C{i-1};
end
T=toeplitz(1:N+1,ones(1,N))
Q_tilde=blkdiag(speye(2*N),P);
B_tilde=cell2mat(C(T));
  2 件のコメント
wissal zaher
wissal zaher 2022 年 9 月 6 日
Thank you for the reply, I think this is a very good way to get B_tilde, howerer the dimension should be 16x7 and with your code it gives out a 14x7 Matrix
Matt J
Matt J 2022 年 9 月 6 日
Fixed.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by