| 查看: 2146 | 回复: 3 | ||||
niexianling铜虫 (初入文坛)
|
[求助]
matlab中std2函数计算矩阵的标准差时,分母是除以了n-1还是n?
|
|
matlab中std2函数计算矩阵的标准差时,分母是除以了n-1还是n? 这是如下代码 function s = std2(a) %STD2 Standard deviation of matrix elements. % B = STD2(A) computes the standard deviation of the values in % A. % % Class Support % ------------- % A can be numeric or logical. B is a scalar of class double. % % Example % ------- % I = imread('liftingbody.png'); % val = std2(I) % % See also CORR2, MEAN2, MEAN, STD. % Copyright 1992-2010 The MathWorks, Inc. % $Revision: 5.19.4.6 $ $Date: 2010/09/13 16:14:04 $ % validate that our input is valid for the IMHIST optimization fast_data_type = isa(a,'logical') || isa(a,'int8') || isa(a,'uint8') || ... isa(a,'uint16') || isa(a,'int16'); % only use IMHIST for images of sufficient size big_enough = numel(a) > 300000; if fast_data_type && isequal(ndims(a),2) && ~issparse(a) && big_enough % compute histogram if islogical(a) num_bins = 2; else data_type = class(a); num_bins = double(intmax(data_type)) - double(intmin(data_type)) + 1; end [bin_counts bin_values] = imhist(a, num_bins); % compute standard deviation total_pixels = numel(a); sum_of_pixels = sum(bin_counts .* bin_values); mean_pixel = sum_of_pixels / total_pixels; bin_value_offsets = bin_values - mean_pixel; bin_value_offsets_sqrd = bin_value_offsets .^ 2; offset_summation = sum( bin_counts .* bin_value_offsets_sqrd); s = sqrt(offset_summation / total_pixels); else % use simple implementation if ~isa(a,'double') a = double(a); end s = std(a( );end |
» 猜你喜欢
第一性原理计算方向2026级博士申请 PRB*1,四级484
已经有1人回复
求助VISSIM破解版软件
已经有0人回复
物理学I论文润色/翻译怎么收费?
已经有98人回复
求2026年在台湾举行的物理和材料领域国际学术会议信息
已经有0人回复
求国际会议网站
已经有1人回复
求取一些关于纳米材料和纳米技术相关的英文PPT。
已经有0人回复
【复旦大学】二维材料方向招收2026年博士研究生1名
已经有0人回复
北京纳米能源与系统研究所 王中林院士/曹南颖研究员课题组2026级硕/博/博后招生
已经有10人回复
荷兰Utrecht University超快太赫兹光谱王海教授课题招收2026 CSC博士生
已经有14人回复
反铁磁体中的磁性切换:两种不同的机制已成功可视化
已经有0人回复

月只蓝
主管区长 (职业作家)
-

专家经验: +1059 - 计算强帖: 8
- 应助: 1712 (讲师)
- 贵宾: 8.888
- 金币: 68120.7
- 散金: 1938
- 红花: 443
- 沙发: 4
- 帖子: 4373
- 在线: 3291.4小时
- 虫号: 1122189
- 注册: 2010-10-14
- 专业: 宇宙学
- 管辖: 计算模拟区
【答案】应助回帖
★
感谢参与,应助指数 +1
csgt0: 金币+1, 谢谢 2013-06-28 11:32:57
感谢参与,应助指数 +1
csgt0: 金币+1, 谢谢 2013-06-28 11:32:57
|
默认的是N-1吧,以下是MATLAB 帮助文档的说明: STD Standard deviation. For vectors, Y = STD(X) returns the standard deviation. For matrices, Y is a row vector containing the standard deviation of each column. For N-D arrays, STD operates along the first non-singleton dimension of X. STD normalizes Y by (N-1), where N is the sample size. This is the sqrt of an unbiased estimator of the variance of the population from which X is drawn, as long as X consists of independent, identically distributed samples. Y = STD(X,1) normalizes by N and produces the square root of the second moment of the sample about its mean. STD(X,0) is the same as STD(X). Y = STD(X,FLAG,DIM) takes the standard deviation along the dimension DIM of X. Pass in FLAG==0 to use the default normalization by N-1, or 1 to use N. |

2楼2013-06-27 10:34:09
niexianling
铜虫 (初入文坛)
- 应助: 0 (幼儿园)
- 金币: 20
- 红花: 2
- 帖子: 50
- 在线: 23.4小时
- 虫号: 1661372
- 注册: 2012-03-03
- 性别: MM
- 专业: 化学计量学与化学信息学

3楼2013-06-27 11:00:36
4楼2013-06-27 14:43:54













);
回复此楼