螺旋线的画法---matlab代码
程序员文章站
2022-06-07 14:42:19
...
clearvars;
close all;
clc;
%每个圆的周长是一样的
t = 0:0.01:4*pi;
x = cos(t);
y = sin(t);
z = t*2;
figure;
plot3(x,y,z,'r-');
hold on;
plot3(x,-y,z,'b')
title('螺旋线');
xlabel('x axis');
ylabel('y axis');
zlabel('z axis');
grid on;
clearvars;
close all;
clc;
%每个圆的周长是一样的
t = 0:0.01:4*pi;
x = cos(t);
y = sin(t);
z = t*2;
figure;
plot3(x,y,z);
title('螺旋线');
xlabel('x axis');
ylabel('y axis');
zlabel('z axis');
grid on;
%圆的周长是递增的
t = 0:0.01:10*pi;
A = 1;
w = 1;
sita = 0;
for ii = 1:length(t)
x(ii) = A *cos(w*t(ii) + sita);
y(ii) = A *sin(w*t(ii) + sita);
A = A+ 0.1;
end
z = t*2;
figure;
plot3(x,y,z,'r');
title('螺旋线');
xlabel('x axis');
ylabel('y axis');
zlabel('z axis');
grid on;
上一篇: C++循环输出M * N 的螺旋矩阵
下一篇: 7-32 螺旋方阵