Delete - Variance vs standard deviation when using var() and std() with decimal values from CSV file?

28 次查看(过去 30 天)
Hello all!
I am getting a strange error in Matlab where the variance is smaller than the standard deviation when using var() and std(), despite the fact that I am working with nW of optical power. (This is correct - the standard deviation is the square root of the variance.) The code I am using is as follows:
[D,S] = xlsread('2019-11-21_Empirical_Experiment_2.0_2.0_3.csv');
Vars = strsplit(S{15},';');
for k = 16:size(S,1)
DataC = strsplit(S{k},';');
pwr_2_2(k-15,:) = str2double(DataC{4});
end
mpwr_2_2=mean(pwr_2_2)
vpwr_2_2=var(pwr_2_2)
spwr_2_2=std(pwr_2_2)
The csv file is attached. I am at a loss for how to exactly diagnose this issue and I welcome any advice that you can give. I thought that the method for importing the data from the csv (thanks to some help from Matlab Answers!) was working well, but maybe the issue is rooted in the data import? Thanks in advance, and let me know if there are any questions!

采纳的回答

Philippe Lebel
Philippe Lebel 2019-11-22
Isn't this normal?
As the variance is the square of the standard deviation?
0.1^2 = 0.01

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Axis Labels 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by