matlab画爱心代码分享

这个是别人的

close all; clear;

x=linspace(0,2*pi);
% n=100;
% t=0:2*pi/n:2*pi;
for k=1:length(x)
    clf; hold on;

    plot(cos(x),sin(x));
%FEST KREIS
    plot(2*cos(k)-cos(x),2*sin(k)-sin(x));
%DREH KREIS
   hold on;

   plot(2*(1-cos(x(1:k))).*cos(x(1:k))+1,2*(1-cos(x(1:k))).*sin(x(1:k)),'r','LineWidth',4);
   %HERZ LINE

   plot(2*(1-cos(x)).*cos(x)+1,2*(1-cos(x)).*sin(x));
      %HERZ LINE

     plot(2*(1-cos(k)).*cos(k)+1,2*(1-cos(k)).*sin(k),'-ko','LineWidth',2,...
       'MarkerEdgeColor','k', 'MarkerSize',5,'MarkerFaceColor','w');  

%     plot(2*cos(k)-cos(2*(k)),2*sin(k)-sin(2*(k)));
   axis equal;
    F(k)=getframe;
end
clf; axis off;

movie(F,20)

image.png

这个是我的

figure('MenuBar','none','NumberTitle','off','color','black');
t = 0:pi/200:2*pi;
x = 16*sin(t).^3;
y = 13*cos(t)-5*cos(2*t)-cos(4*t);
patch(x,y,[1,0,0])
axis equal
axis off

image.png

你可能感兴趣的:(matlab画爱心代码分享)