用MATLAB编译出平面爱心图形
以下是用MATLAB编写的平面爱心图形代码:
theta = linspace(0, 2*pi, 1000);
r = 1 - sin(theta);
x = r.*cos(theta);
y = r.*sin(theta);
plot(x, y, 'r', 'LineWidth', 2);
hold on;
r = 1 + sin(theta);
x = r.*cos(theta);
y = r.*sin(theta);
plot(x, y, 'r', 'LineWidth', 2);
axis equal;
title('平面爱心图形');
运行以上代码,可以得到以下平面爱心图形:

原文地址: https://www.cveoy.top/t/topic/g0B3 著作权归作者所有。请勿转载和采集!