clc
clear
x=linspace(-10,10,20);
y1=-x.^2;
y2=-2.*x.^2;
y3=-3.*x.^2;
y4=-4.*x.^2;
y5=-5.*x.^2;% matlab元组(cell)的使用:元组的一个元素可以存储一个矩阵
box{1}(:,1)=x; box{1}(:,2)=y1;
box{2}(:,1)=x; box{2}(:,2)=y2;
box{3}(:,1)=x; box{3}(:,2)=y3;
box{4}(:,1)=x; box{4}(:,2)=y4;
box{5}(:,1)=x; box{5}(:,2)=y5;%=====================================================================figure(1);plot(x,y1,'-or','LineWidth',1.5,'MarkerSize',8); hold on;plot(x,y2,'-^b','LineWidth',1.5,'MarkerSize',8); hold on;plot(x,y3,'-s','LineWidth',1.5,'MarkerSize',8); hold on;plot(x,y4,'-dg','LineWidth',1.5,'MarkerSize',8); hold on;plot(x,y5,'-hm','LineWidth',1.5,'MarkerSize',8); hold on;%---------------------------------------------------------------------set(legend('$k=1$',...'$k=2$',...'$k=3$',...'$k=4$',...'$k=5$',...'Location','south'),'Interpreter','latex','FontSize',15,'fontname','Times New Roman')% north south west east
%---------------------------------------------------------------------set(gca,'FontSize',15,'fontname','Times New Roman')%是设置刻度字体大小
%set(gca,'YScale','log')%set(gca,'XScale','log')set(gca,'XLim',[-10,10])set(gca,'YLim',[-500,0])xlabel('$x$','Interpreter','latex','FontSize',20,'fontname','Times New Roman')ylabel('$y=kx^2$','Interpreter','latex','FontSize',20,'fontname','Times New Roman')%---------------------------------------------------------------------% 标注极值点
%[极值,极值点]=max(向量);%获取最大值点和最大值
%[~,极值点]=max(向量);%获取最大值点
%---------------------------------------------------------------------% 导出高分辨率(700)png图片
img1 =gcf;%获取当前画图的句柄
print(img1,'-dpng','-r700','./img1.png')%=====================================================================