Delete - Variance vs standard deviation when using var() and std() with decimal values from CSV file?
4 views (last 30 days)
Show older comments
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!
0 Comments
Accepted Answer
Philippe Lebel
on 22 Nov 2019
Isn't this normal?
As the variance is the square of the standard deviation?
0.1^2 = 0.01
More Answers (0)
See Also
Categories
Find more on Axis Labels in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!