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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by