matlab绘制动态爱心

代码

clc;clear all;
a=10;
x=-2:0.01:2;
set(gcf,'position',[100,0,800,600],'color','w');
for i=1:100
    clf;
    y = abs(x).^(2/3)+(0.9*sqrt((3.3-x.^2))).*sin(a*pi*x);
    a=i/10;
    set(gcf,'position',[0,0,800,600],'color','w');
    p1 = plot(x,y,'r','LineWidth',3);
    hold on;
    title('\color{red}爱你~宝宝','fontsize',15);
    xlim([-2 2]);
    ylim([-1.5 2.5]);
    pause(0.1);
end

效果

matlab绘制动态爱心_第1张图片

你可能感兴趣的:(matlab,matlab)