to plot a introduced function

1 回表示 (過去 30 日間)
reza hamzeh
reza hamzeh 2019 年 10 月 19 日
回答済み: reza hamzeh 2019 年 10 月 19 日
hi. i wrote 4 functions. now i want to plot the forth function but it gives me errors. plz help me to plot it.
plot3(C(J,d),J,d)
function ha = H(J,d)
sx=[0 1;1 0];
sy=[0 -1i;1i 0];
sz=[1 0;0 -1];
ha = J/2*(kron(sx,sx)+kron(sy,sy)+kron(sz,sz))+d*(kron(sx,sy)-kron(sy,sx));
end
function ro = R(J,d)
T=0.5;
ro = expm(-H(J,d)/T)/trace(expm(-H(J,d)/T));
end
function la = landa(J,d)
sy=[0 -1i;01i 0];
s=kron(sy,sy);
la = real(sqrt(eig(R(J,d)*s*conj(R(J,d))*s)));
end
function co = C(J,d)
co=max(0,2*max(landa(J,d))-sum(landa(J,d)));
end
  1 件のコメント
David Hill
David Hill 2019 年 10 月 19 日
What do you want plotted? co will be a row vector for a given inputs J and d. How do you want to vary J and d and then do you want and 3D plot of J,d and every element of co?

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

採用された回答

David Hill
David Hill 2019 年 10 月 19 日
J=-1:.1:1;
d=0:.1:5;
[J,d]=meshgrid(J,d);
Z=zeros(size(J));
for i=1:size(J,1)
for j=1:size(J,2)
Z(i,j)=C(J(i,j),d(i,j));
end
end
surf(J,d,Z);
The above plots the surf plot of the J,d grid with height Z.

その他の回答 (2 件)

reza hamzeh
reza hamzeh 2019 年 10 月 19 日
for any J and d, co is a number. its not a vector. i want to plot co for 0<d<5 and -1<J<1 but i dont know how to do that. plz help me.

reza hamzeh
reza hamzeh 2019 年 10 月 19 日
thank u very much

カテゴリ

Help Center および File ExchangeExploration and Visualization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by