How do I create a density plot?

조회 수: 5 (최근 30일)
JJH
JJH 2017년 8월 4일
댓글: JJH 2017년 8월 4일
Hi, I'm trying to make a density plot using pcolor that shows we1 on one axis, t on the other and the colour map as the trace distance between the matrices I've defined. I just want to produce a list of values for varying we1 and t but I get the error:
Error using * Inner matrix dimensions must agree.
Error in Untitled8 (line 16) H1=we1*kron(PauliX,eye(2))+A1*(kron(PauliX,PauliX)+kron(PauliY,PauliY)+kron(PauliZ,PauliZ));
How should I do this differently?
n=0.1;
we1=0:0.001:n;
m=500;
t=0:m;
A1=0.00448;
PauliX=[0 1; 1 0];
PauliY=[0 -1i; 1i 0];
PauliZ=[1 0; 0 -1];
rhoE=[0.5 + 0.115047 0.564418 - 0.0959956*1i; 0.564418 + 0.0959956*1i 0.5 - 0.115047];
rhoN=[0.5 0; 0 0.5];
rhoEN=kron(rhoE,rhoN);
SWAP=[1 0 0 0; 0 0 1 0; 0 1 0 0; 0 0 0 1];
for i=1:length(t)
for j=0:length(we1)
H1=we1.*kron(PauliX,eye(2))+A1*(kron(PauliX,PauliX)+kron(PauliY,PauliY)+kron(PauliZ,PauliZ));
U1=expm(-1i*H1*t);
rhoENout=U1*rhoEN*U1';
USWAP=expm(-1i*SWAP*t);
SWAPout=USWAP*rhoEN*USWAP';
tdSWAPEN1=(rhoENout-SWAPout)^2;
tdSWAPEN2=sqrt(sum(tdSWAPEN1(:)));
end
end
X=we1;
Y=t;
C=tdSWAPEN2;
pcolor(X,Y,C)
axis equal tight
  댓글 수: 2
Dan Gianotti
Dan Gianotti 2017년 8월 4일
편집: Dan Gianotti 2017년 8월 4일
I haven't looked too closely at what you're trying to do, but at least one problem is in this part:
we1.*kron(PauliX,eye(2))
since size(we1) is [1,101] and size(kron(...)) is [4,4].
JJH
JJH 2017년 8월 4일
So is there a way to times each iteration by a different value of we and keep them all?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by