Here is the code that creates some sample data, there are 2 columns, the first is time and the second is volts:
data = [0, 2.56; ...
0.12325, 2.58; ...
0.134564, 2.6233; ...
1.2133, 2.45; ...
1.3425, 2.56];
Here is the code that calculates the mean and variance. The :
in the first location means to use all rows, the 2
means to use the second column. This will work with any number of rows.
mean_data = mean(data(:, 2))
variance_data = var(data(:, 2))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…