本文基於阿基公尺德螺旋線的基本理論,用matlab實現阿基公尺德螺旋線的繪製**。
project code
% 日期:2021.1
.6 星期三%*
****
****
****
****
****
**模擬阿基公尺德螺旋線型***
****
****
****
****
****
***%
% 極座標圖
clear,clc;
cir =
input
('輸入阿基公尺德螺旋線的旋向(右旋為1,左旋為0):');
r0 =
input
('輸入阿基公尺德螺旋線的起始半徑(單位cm):');
landa_spp =
input
('輸入阿基公尺德螺旋線的螺距(單位cm):');
if cir ==
0 angle =
linspace(0
,8*pi,
1000);
r = r0 + landa_spp*angle/(2
*pi)
;polar
(angle,r)
;elseif cir ==
1 angle =
linspace(0
,-8*pi,
1000);
r = r0 + landa_spp*
(-angle)/(
2*pi)
;polar
(angle,r)
;end
% figure處理***
****
****
****
****
****
****
**if cir ==
0title
('極座標-左旋阿基公尺德螺旋線');
elseif cir ==
1title
('極座標-右旋阿基公尺德螺旋線');
end
% 日期:2021.1
.6 星期三%*
****
****
****
****
****
**模擬阿基公尺德螺旋線型***
****
****
****
****
****
***%
% 直角座標圖
clear,clc;
cir =
input
('輸入阿基公尺德螺旋線的旋向(右旋為1,左旋為0):');
r0 =
input
('輸入阿基公尺德螺旋線的起始半徑(單位cm):');
landa_spp =
input
('輸入阿基公尺德螺旋線的螺距(單位cm):');
if cir ==
0 angle =
linspace(0
,8*pi,
1000);
r = r0 + landa_spp*angle/(2
*pi)
; x = r.
*cos
(angle)
; y = r.
*sin
(angle)
;plot
(x,y)
;elseif cir ==
1 angle =
linspace(0
,-8*pi,
1000);
r = r0 + landa_spp*
(-angle)/(
2*pi)
; x = r.
*cos
(angle)
; y = r.
*sin
(angle)
;plot
(x,y)
;end
% figure處理***
****
****
****
****
****
****
**xlabel
('座標x'),
ylabel
('座標y');
if cir ==
0title
('直角座標-左旋阿基公尺德螺旋線');
elseif cir ==
1title
('直角座標-右旋阿基公尺德螺旋線');
endgrid on;
% 日期:2021.1
.6 星期三%*
****
****
****
****
****
**三維(空間)螺旋線型***
****
****
****
****
****
***%
% 拓展內容
clear,clc;
cir =
input
('輸入螺旋線的旋向(右旋為1,左旋為0):');
r0 =
input
('輸入螺旋線的起始半徑(單位cm):');
l =input
('輸入螺旋線的螺距(單位cm):');
if cir ==
0 angle =
linspace(0
,8*pi,
1000);
r = r0 + l*angle/(2
*pi)
; x = r.
*cos
(angle)
;%x-y平面圖形基於阿基公尺德螺旋線
y = r.
*sin
(angle)
; z = angle/pi;
%z方向自定義
plot3
(x,y,z)
;elseif cir ==
1 angle =
linspace(0
,-8*pi,
1000);
r = r0 + l*
(-angle)/(
2*pi)
; x = r.
*cos
(angle)
;%x-y平面圖形基於阿基公尺德螺旋線
y = r.
*sin
(angle)
; z =
-angle/pi;
%z方向自定義
plot3
(x,y,z)
;end
% figure處理***
****
****
****
****
****
****
**title
('螺旋線');
xlabel
('x axis'),
ylabel
('y axis'),
zlabel
('z axis');
grid on;
**結果圖:
專欄內容供作者本人或大家學習使用,多多指教 ~
python繪製螺旋線
coding utf 8 from math import sqrt,cos,sin import image,imagedraw class spireshape object def init self,draw self.draw draw self.line width 1 self.lin...
在Matlab中繪製阿基公尺德螺線
阿基公尺德螺線 archimedean spiral 亦稱 等速螺線 當一點p沿動射線op以等速率運動的同時,這射線又以等角速度繞點o旋轉,點p的軌跡稱為 阿基公尺德螺線 它的極座標方程為 這種螺線的每條臂的間距永遠相等於 2 b 起始位置 b 10 螺線間距引數 theta 0 0.05 pi 5...
螺旋線擬合
實驗座標是這樣的 基本是乙個阿基公尺德螺旋線,原資料是笛卡爾座標系的,通過擬合半徑與方位角之間的關係得到多項式 以下是多項式擬合 將資料回代,clear all clcformat long shuju xlsread jingpan12 p 5.00630375898308e 06,0.00046...