standard deviation in matlab
Show older comments
Hello, I have calculate in my program the mean value and I am trying to calculate the standard deviaton value of an array 20x20, without using the std command.Next, I compare my result to that whoch I get when I use the std command, but they are different.Could someone explain me the reason? Is their any problem in the types of my algorithm? Here is my code:
mean_value = 65.4250;
sum_dev = 0;
for i=1:1:20
for j=1:1:20
sum_dev = sum_dev + ((ROI(i,j)- mean_value)^2);
end;
end;
std_dev = ((sum_dev/(40-1))^(1/2));
disp(std_dev);
129.0786
std(ROI(:), 0,1)
ans =
40.3552
1 Comment
Jan
on 9 Mar 2011
Sorry for asking: Is the "mean_value" the mean of the values?!
Accepted Answer
More Answers (0)
Categories
Find more on Specialized Power Systems 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!