close all
clear all
a=1:0.25:25;
N=length(a);
% T=1/a;
y_mat=cell(1,N);
x_mat=cell(1,N);
for n=1:N
x=-2:0.01:2;
xb=abs(x);
y=power(xb,2/3)+0.9.*(sqrt(3.3-xb.^2)).*sin(a(n)*pi.*xb);
y=real(y);
% 找到中间平台突起部分,剔除部分自变量x
[y2,idx]=sort(y);
dropIdx=idx(1):idx(2)-1;
x_shift=abs(x(idx(2))-x(idx(1)))/2;
y(dropIdx)=[];
x(dropIdx)=[];
for i=1:1:length(x)
if x(i)>0
x(i)=x(i)-x_shift;
else
x(i)=x(i)+x_shift;
end
end
y_mat{n}=y(:);
x_mat{n}=x(:);
end
figure
for n=1:N
plot( x_mat{n},y_mat{n},'-r','linewidth',1);
xlim([-3 3])
ylim([-2 4])
grid on
% lgdName=sprintf('$\alpha$=%2.1f',a(n));
lgdName=sprintf('α=%2.1f',a(n));
if n==1
annotation('textbox', [0.27 0.74 0.33 0.10],...
'String',{'$ f(x)=x^\frac{2}{3}+0.9\sqrt{3.3-x^2}\sin(\alpha \pi x)$'},...
'interpreter','latex','Fontname',...
'Times New Roman','Fontsize',12,...
'FitBoxToText','off',...
'EdgeColor','none');
end
% 'String',{'$\rm{Epoch=40}$'},...
lgd=legend(lgdName);
set(lgd,'interpreter','latex','Fontname','Times New Roman','Fontsize',12);
% hold on
pause(0.02)
end
% https://www.zhihu.com/question/303355108