How to write code for hankle and toeplitz matrix?

I have matrices like
F = [CA;CA^2;CA^3;CA^4;CA^5;CA^6;CA^7;CA^8;CA^9;CA^10]
and other matrix is
phi=[CB 0 0 0;
CAB CB 0 0;
CA^2B CAB CB 0;
CA^3B CA^2B CAB CB;
CA^4B CA^3B CA^2B CAB;
CA^5B CA^4B CA^3B CA^2B;
CA^6B CA^5B CA^4B CA^3B;
CA^7B CA^6B CA^5B CA^4B;
CA^8B CA^7B CA^6B CA^5B;
CA^9B CA^8B CA^7B CA^6B]
How can I do matlab coding for these matrices

3 件のコメント

the cyclist
the cyclist 2014 年 9 月 12 日
I assume A, B, and C variables you already have.
Matt J
Matt J 2014 年 9 月 13 日
Does CA^2 signify C*A^2 or (CA)^2 where 'CA' is the name of one variable. Are A,B,C scalars are matrices and, if matrices, of what size?
baruch
baruch 2014 年 9 月 14 日
I have matrices like
F = [CA;CA^2;CA^3;CA^4;CA^5;CA^6;CA^7;CA^8;CA^9;CA^10] and other matrix is
phi=[CB 0 0 0; CAB CB 0 0; CA^2B CAB CB 0; CA^3B CA^2B CAB CB; CA^4B CA^3B CA^2B CAB; CA^5B CA^4B CA^3B CA^2B; CA^6B CA^5B CA^4B CA^3B; CA^7B CA^6B CA^5B CA^4B; CA^8B CA^7B CA^6B CA^5B; CA^9B CA^8B CA^7B CA^6B]
How can I do matlab coding for these matrices if C=[0,0,0,0,0,1];
A=[0.951229424500714,0,0,0,0,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,0;-0.00799415471554044,2.05514658489028,0.951087777342890,0,0,0;0,0,0,1,0,0;3.85664115847093e-05,-0.00999690651487826,-5.08357475891134e-08,0.0100000000000000,1,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,1]
B=[0;0.00150727991601721;289.187620200957;0;-5.05813015832678e-06;0.00150727991601721]
I need generalised code as in case given above it is for N=10.if I take any value then what will be it's code?

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

 採用された回答

Roger Stafford
Roger Stafford 2014 年 9 月 13 日
編集済み: Roger Stafford 2014 年 9 月 13 日

3 投票

My apologies! I was not thinking clearly when I wrote the nonsensical A.^(0:9). The following should produce the desired two arrays.
M = 6; % A is M x M, B is M x 1, C is 1 x M
N = 10;
F = zeros(N+1,M);
F(1,:) = C;
for k = 2:N+1
F(k,:) = F(k-1,:)*A;
end
r = F(1:N,:)*B;
c = [C*B;zeros(M-1,1)];
phi = toeplitz(r,c);
F = F(2:N+1,:);

5 件のコメント

baruch
baruch 2014 年 9 月 14 日
phi=[CB 0 0 0; CAB CB 0 0; CA^2B CAB CB 0; CA^3B CA^2B CAB CB; CA^4B CA^3B CA^2B CAB; CA^5B CA^4B CA^3B CA^2B; CA^6B CA^5B CA^4B CA^3B; CA^7B CA^6B CA^5B CA^4B; CA^8B CA^7B CA^6B CA^5B; CA^9B CA^8B CA^7B CA^6B]
How can I do matlab coding for these matrices if C=[0,0,0,0,0,1];
A=[0.951229424500714,0,0,0,0,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,0;-0.00799415471554044,2.05514658489028,0.951087777342890,0,0,0;0,0,0,1,0,0;3.85664115847093e-05,-0.00999690651487826,-5.08357475891134e-08,0.0100000000000000,1,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,1]
B=[0;0.00150727991601721;289.187620200957;0;-5.05813015832678e-06;0.00150727991601721]
I need generalised code as in case given above it is for N=10.if I take any value then what will be it's code?
Roger Stafford
Roger Stafford 2014 年 9 月 14 日
Isn't that what I have given you in the code above?
baruch
baruch 2014 年 9 月 15 日
exactly sir.Thankyou.Sir have you worked on predictive control i am doing research work on that and want guideline
Roger Stafford
Roger Stafford 2014 年 9 月 15 日
No, I am sorry. I have never worked in that area.
baruch
baruch 2014 年 9 月 15 日
if you have any idea about any person who is expert in this area? I am searching but didn't find

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

その他の回答 (2 件)

the cyclist
the cyclist 2014 年 9 月 12 日
編集済み: the cyclist 2014 年 9 月 12 日

1 投票

F = C*A.^(1:10)

1 件のコメント

baruch
baruch 2014 年 9 月 13 日
編集済み: baruch 2014 年 9 月 13 日
I have matrices like
F = [CA;CA^2;CA^3;CA^4;CA^5;CA^6;CA^7;CA^8;CA^9;CA^10] and other matrix is
phi=[CB 0 0 0; CAB CB 0 0; CA^2B CAB CB 0; CA^3B CA^2B CAB CB; CA^4B CA^3B CA^2B CAB; CA^5B CA^4B CA^3B CA^2B; CA^6B CA^5B CA^4B CA^3B; CA^7B CA^6B CA^5B CA^4B; CA^8B CA^7B CA^6B CA^5B; CA^9B CA^8B CA^7B CA^6B]
How can I do matlab coding for these matrices if C=[0,0,0,0,0,1];
A=[0.951229424500714,0,0,0,0,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,0;-0.00799415471554044,2.05514658489028,0.951087777342890,0,0,0;0,0,0,1,0,0;3.85664115847093e-05,-0.00999690651487826,-5.08357475891134e-08,0.0100000000000000,1,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,1]
B=[0;0.00150727991601721;289.187620200957;0;-5.05813015832678e-06;0.00150727991601721]
I need generalised code as in case given above it is for N=10.if I take any value then what will be it's code?

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

Roger Stafford
Roger Stafford 2014 年 9 月 12 日
編集済み: Roger Stafford 2014 年 9 月 12 日

0 投票

phi = toeplitz(C*A.^(0:9)*B,zeros(1,4));
It is assumed that C*A^n*B is a scalar.

1 件のコメント

baruch
baruch 2014 年 9 月 13 日
編集済み: baruch 2014 年 9 月 13 日
I have matrices like
F = [CA;CA^2;CA^3;CA^4;CA^5;CA^6;CA^7;CA^8;CA^9;CA^10] and other matrix is
phi=[CB 0 0 0; CAB CB 0 0; CA^2B CAB CB 0; CA^3B CA^2B CAB CB; CA^4B CA^3B CA^2B CAB; CA^5B CA^4B CA^3B CA^2B; CA^6B CA^5B CA^4B CA^3B; CA^7B CA^6B CA^5B CA^4B; CA^8B CA^7B CA^6B CA^5B; CA^9B CA^8B CA^7B CA^6B]
How can I do matlab coding for these matrices if C=[0,0,0,0,0,1];
A=[0.951229424500714,0,0,0,0,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,0;-0.00799415471554044,2.05514658489028,0.951087777342890,0,0,0;0,0,0,1,0,0;3.85664115847093e-05,-0.00999690651487826,-5.08357475891134e-08,0.0100000000000000,1,0;-0.00764874141234696,0.999384908699207,1.00818092264771e-05,0,0,1]
B=[0;0.00150727991601721;289.187620200957;0;-5.05813015832678e-06;0.00150727991601721]
I need generalised code as in case given above it is for N=10.if I take any value then what will be it's code?

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

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2014 年 9 月 12 日

コメント済み:

2014 年 9 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by