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일

0 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Matrix Indexing에 대해 자세히 알아보기

제품

릴리스

R2021b

질문:

2022년 9월 6일

댓글:

2022년 9월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by