clc;clear;close all;
a=sqrt(3.3); %坐标范围
x=-a:0.005:a; %横坐标
f=@(b)(abs(x.^(2/3))+0.9*sqrt(3.3-x.^2).*sin(b*pi*x)); %图形函数
syms t b;
g=(abs(t^(2/3))+0.9*(3.3-t^2)^(1/2)*sin(b*pi*t)); %图形函数
g1=latex(g);
g2=['$' g1 '$'];
figure(1)
set(gcf,'Position',[200 100 500 550]);
h=plot(x,f(0),'r');
title('heart');axis([-a a -1.8 3]);
text('interpreter','latex','String',g2,'Position',[-1.5 2.6],'FontSize',16);
st=text(0.8,2.6,['b=',num2str(0)]);
for b=0:0.2:12 %图形参数
set(h,'ydata',f(b));
set(st,'string',['b=',num2str(b)])
pause(0.1);
end