How do I create a density plot?

2 次查看(过去 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