如何用VBA进行姿态重复性的数据分析?
1、在VBA中输入
Sub 姿态重复性()
End Sub

2、变量的定义.
Dim i As Integer
Cells(1, 1).Value = "a轴坐标"
Cells(1, 2).Value = "b轴坐标"
Cells(1, 3).Value = "c轴坐标"
Cells(1, 4).Value = "a轴坐标平均值"
Cells(1, 5).Value = "b轴坐标平均值"
Cells(1, 6).Value = "c轴坐标平均值"
Cells(1, 7).Value = "a轴姿态重复性"
Cells(1, 8).Value = "a轴差方"
Cells(1, 9).Value = "b轴差方"
Cells(1, 10).Value = "c轴差方"
Cells(3, 7).Value = "b轴姿态重复性"
Cells(5, 7).Value = "c轴姿态重复性"
Cells(5, 4).Value = "a轴差方和"
Cells(7, 4).Value = "b轴差方和"
Cells(9, 4).Value = "c轴差方和"
Cells(2, 4) = 0
Cells(2, 5) = 0
Cells(2, 6) = 0
Cells(6, 4) = 0
Cells(8, 4) = 0
Cells(10, 4) = 0

3、原始数据的上色标记.
For j = 2 To 151 Step 5
Cells(j + 4, 1).Interior.Color = RGB(0, 255, 0)
Cells(j + 4, 2).Interior.Color = RGB(0, 255, 0)
Cells(j + 4, 3).Interior.Color = RGB(0, 255, 0)
Next

4、For j = 2 To 151 Step 5
Cells(2, 4) = Cells(j + 4, 1) + Cells(2, 4) 'a轴求和
Next
Cells(2, 4) = Cells(2, 4) / 30 'a轴平均值
For j = 2 To 151 Step 5
Cells(j + 4, 8) = (Cells(j + 4, 1) - Cells(2, 4)) ^ 2 'a轴差方
Next
For j = 2 To 151 Step 5
Cells(6, 4) = Cells(6, 4) + Cells(j + 4, 8) 'a轴差方和
Next
Cells(2, 7) = (Cells(6, 4) / 29) ^ 0.5 'a轴姿态重复性

5、For j = 2 To 151 Step 5
Cells(2, 5) = Cells(j + 4, 2) + Cells(2, 5) 'b轴求和
Next
Cells(2, 5) = Cells(2, 5) / 30 'b轴平均值
For j = 2 To 151 Step 5
Cells(j + 4, 9) = (Cells(j + 4, 2) - Cells(2, 5)) ^ 2 'b轴差方
Next
For j = 2 To 151 Step 5
Cells(8, 4) = Cells(8, 4) + Cells(j + 4, 9) 'b轴差方和
Next
Cells(4, 7) = (Cells(8, 4) / 29) ^ 0.5 'b轴姿态重复性

6、For j = 2 To 151 Step 5
Cells(2, 6) = Cells(j + 4, 3) + Cells(2, 6) 'c轴求和
Next
Cells(2, 6) = Cells(2, 6) / 30 'c轴平均值
For j = 2 To 151 Step 5
Cells(j + 4, 10) = (Cells(j + 4, 3) - Cells(2, 6)) ^ 2 'c轴差方
Next
For j = 2 To 151 Step 5
Cells(10, 4) = Cells(10, 4) + Cells(j + 4, 10) 'c轴差方和
Next
Cells(6, 7) = (Cells(10, 4) / 29) ^ 0.5 'c轴姿态重复性
