Check summation from n=0 to 5 |n><n| in MATLAB?

1 回表示 (過去 30 日間)
Abu Zar
Abu Zar 2023 年 1 月 11 日
回答済み: Bjorn Gustavsson 2023 年 1 月 11 日
D=5;
tmpI=eye(D);
ket0=tmpI(:,1); %|0>
ket1=tmpI(:,2); %|1>
ket2=tmpI(:,3); %|2>
ket3=tmpI(:,4); %|3>
ket4=tmpI(:,5); %|4>
ket5=tmpI(:,6); %|5>
% bra is the transpose of ket
bra0=tmpI(1,:); % <0|
bra1=tmpI(2,:); % <1|
bra2=tmpI(3,:); % <2|
bra3=tmpI(4,:); % <3|
bra4=tmpI(5,:); % <4|

採用された回答

Bjorn Gustavsson
Bjorn Gustavsson 2023 年 1 月 11 日
If |n><n| is the same as <n||n> then you should have a look at the help and documentation to dot. That function will not generalize well to the more general <n|G|n>. For that you might get away with the standard vector-matrix-vector products where you'll have to make some discrete version of the operator G. If |n><n| is not the same as <n||n> you might have to explain what it is supposed to be.
HTH

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDirection of Arrival Estimation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by