Matlab代码:
close all;
alpha = -pi : pi/50 : pi;
x = 2*cos(alpha);
y = 2*sin(alpha);
for p=1:length(x)
alpha1 = -pi : pi/100 : pi;
x1 = 1*cos(alpha1);
y1 = 1*sin(alpha1);
hold on;
plot(x(1,p)+x1,y(1,p)+y1-1,‘g‘);
end
axis off;
hold on;
theta = -pi: pi/50 :pi;
rho = 2*(1-sin(theta));
polar(theta,rho,‘* r‘);%画红色心形线
axis off;
原文:http://hanxu1988.blog.51cto.com/4721074/1431341