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

조회 수: 14(최근 30일)
CW
CW 2019년 11월 22일
편집: CW 2019년 11월 22일
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개)

Community Treasure Hunt

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

Start Hunting!

Translated by