필터 지우기
필터 지우기

Making 10 2D slices out of 3D plot

조회 수: 15 (최근 30일)
Raja Emlik
Raja Emlik 2016년 1월 20일
답변: Walter Roberson 2016년 1월 20일
Can i make the first plot like the second plot but at fixed variable which means i want to make 10 2D slices of 3D by fixing b (beta) at a constant value:(0, .1, .2, .........1).
This my 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)]; % angles;
lb=[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];
%x0=[pi/8;0;pi/3;0;0.7*pi;.6;0;pi/2;.5;0;pi/4;0];
options = optimoptions(@fmincon,'TolX',10^-12,'MaxIter',1500,'MaxFunEvals',10^8,'Algorithm','sqp','TolFun',10^-8);
a=0:0.01:1;
%b=0:0.1:1;
b=.5;
%w=NaN(length(a),length(b));
w=NaN(size(a));
%ww=NaN(length(a),length(b));
ww=NaN(size(a));
for k=1:50
x0=rand([1,12]).*ub*.9986;%7976
for i=1:length(a)
%for j=1:length(b)
chelp=1-(a(i)^2)-(b^2);
if (chelp>0 || chelp==0)
c=sqrt(chelp);
[~,fval]=fmincon(@(x)GHZsb2(x,a(i),b,c),x0,[],[],[],[],lb,ub,[],options);
w(i)=sqrt(-fval);
else
w(i)=nan;
end
ww=max(w,ww);
end
end
%end
%yy=b.^2;
xx=a.^2;
%surface(h,y,ww)
%view(3)
%meshc(xx,yy,ww)
plot(xx,ww)
grid on
ylabel('\fontname{Times New Roman} S_{max}(\Psi_{G})')
xlabel('\fontname{Times New Roman}\alpha^2')
%axis([0 2*pi -1.5 1.5])
%ylabel('\fontname{Times New Roman}\beta^2')

답변 (1개)

Walter Roberson
Walter Roberson 2016년 1월 20일

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by