Filter löschen
Filter löschen

Plotting 3 variables against 1 variable

2 Ansichten (letzte 30 Tage)
Raja Emlik
Raja Emlik am 23 Feb. 2016
Kommentiert: Aditya Desai am 23 Feb. 2016
I have a code that computes the max value. this code consists of four variables www is the function of a,b, and c labaled xx, yy, and zz respectively, so my question is how can i plot www against xx,yy, and zz? Thanks for helping
my main file of the code
clear
close
clc
%x=[x(1),x(2),x(3),x(4),x(5),x(6),x(7),x(8),x(9),x(10),x(11),x(12),x(13),x(14),x(15),x(16)]; % angles;
lb=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];
ub=[pi,2*pi,pi,2*pi,pi,2*pi,pi,2*pi,pi,2*pi,pi,2*pi,pi,2*pi,pi,2*pi];
options = optimoptions(@fmincon,'TolX',10^-12,'MaxIter',1500,'MaxFunEvals',10^8,'Algorithm','sqp','TolFun',10^-8);
a=0:0.1:1;
b=0:0.1:1;
c=0:0.1:1;
w=NaN(length(a),length(b),length(c));
ww=NaN(length(a),length(b),length(c));
www=NaN(length(a),length(c));
for k=1:100
x0=rand([1,16]).*ub*.9986;
for i=1:length(a)
for j=1:length(b)
for l=1:length(c)
dhelp=1-(a(i)^2)-(b(j)^2)-(c(l)^2);
if (dhelp>0 || dhelp==0)
d=sqrt(dhelp);
[~,fval]=fmincon(@(x)W4qubit(x,a(i),b(j),c(l),d),x0,[],[],[],[],lb,ub,[],options);
w(i,j,l)=sqrt(-fval);
else
w(i,j,l)=nan;
end
ww=max(w,ww);
end
end
end
end
www=max(ww,[],3);
yy=b.^2;xx=a.^2;zz=c.^2;
meshc(xx,yy,www)
grid on
zlabel('\fontname{Times New Roman} M_{max}')
xlabel('\fontname{Times New Roman}\alpha^2')
ylabel('\fontname{Times New Roman}\gamma^2')
%title('fontname{Times New Roman} Maximum of the Svetlichny operator. Method 1 (alpha|0001>+beta|0010>+gamma|1000>)')

Antworten (0)

Kategorien

Mehr zu Matrix Indexing finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by