请教各位大侠如何绘制sin+sin的图?
请教各位大侠如何绘制sin+sin的图?我只找到sin的宏,现在想2个sin相加
这是我在网上找的,
Sub sin2()
'由正弦曲线的起点、幅度、周期、周波数、方向来画正弦曲线
Dim sinObj As AcadLWPolyline
Dim points() As Double
Dim a, n, k As Integer
Dim H, f As Double
Dim pa, pb As Variant
PI = 3.1415926535
pa = ThisDrawing.Utility.GetPoint(, "请输入正弦曲线起点:")
H = ThisDrawing.Utility.GetDistance(pa, "请正弦曲线幅度:")
f = ThisDrawing.Utility.GetDistance(pa, "请正弦曲线周期:")
n = ThisDrawing.Utility.GetReal("请输入正弦曲线周波数:")
k = ThisDrawing.Utility.GetReal("请输入正弦曲线每周波线段数(建议不小于36):")
pb = ThisDrawing.Utility.GetPoint(pa, "请输入点以确定正弦曲线的方向:")
ReDim points(0 To 2 * k * n + 1) As Double
b = ThisDrawing.Utility.AngleFromXAxis(pa, pb)
For a = 0 To 2 * k * n Step 2
points(a) = pa(0) + f * (a / 2) / k
points(a + 1) = pa(1) + H * Sin(2 * PI * a / k / 2)
Next
Set sinObj = ThisDrawing.ModelSpace.AddLightWeightPolyline(points)
sinObj.Rotate pa, b
ZoomExtents
End Sub
如果可以输入2个sin各自的幅度和周期就可以知道他们相加的曲线!,谢谢 :( :( :( :( 有人帮一下忙吗?谢谢~
还是看不明我说的是什么意思呀???? 看着有点晕。:Q :L :L 我也看晕了
页:
[1]