< Code 1 >
[X,Y,Z] = sphere(20);
hFig = figure(1,'Position',[300 300 700 600]);
hold on;
plot3([-1.4 1.4],[0 0],[0 0],'k-');
plot3([0 0],[-1.4 1.4],[0 0],'k-');
plot3([0 0],[0 0],[-1.4 1.4],'k-');
phi = linspace(0,2*pi,40);
theta = 0.0 .* linspace(0,2*pi,40);
r = 1.01;
[x,y,z] = sph2cart(theta,phi,r)
plot3(x,y,z,'r-','LineWidth',2);
phi = linspace(0,2*pi,40);
theta = 0.0 .* linspace(0,2*pi,40) + pi/2;
r = 1.01;
[x,y,z] = sph2cart(theta,phi,r)
plot3(x,y,z,'b-','LineWidth',2);
phi = 0.0 .* linspace(0,2*pi,40);
theta = linspace(0,2*pi,40);
r = 1.01;
[x,y,z] = sph2cart(theta,phi,r)
plot3(x,y,z,'k-','LineWidth',2);
% Display qbit
tstep = 0;
pstep = 0;
qbit_theta = 5*tstep;
qbit_phi = 5*pstep;
theta = pi/2-(qbit_theta*pi/180);
phi = qbit_phi*pi/180;
r = 1.01;
[x,y,z] = sph2cart(phi,theta,r);
plot3(x,y,z,'ro','MarkerFaceColor',[1 0 0],'MarkerSize',8);
x = [0 x];
y = [0 y];
z = [0 z];
plot3(x,y,z,'k-');
|