Covariance from standard deviation and correlation (covcorr)

版本 1.0.3 (1.5 KB) 作者: Gregory Pelletier
This MATLAB function converts standard deviation and the correlation matrix to a covariance matrix
10.0 次下载
更新时间 2024/1/29

查看许可证

This MATLAB function converts standard deviation and correlation to covariance
INPUTS:
psigma = vector of standard deviations for each of any number of variables or parameters
prho = correlation matrix of the correlations between each each variable or parameter
OUTPUTS:
pcov = covariance matrix between variables or parameters
EXAMPLE:
load hospital
X = [hospital.Weight hospital.BloodPressure];
% Find the correlation matrix for the variables X:
prho = corrcoef(X)
% prho =
% 1.0000 0.1558 0.2227
% 0.1558 1.0000 0.5118
% 0.2227 0.5118 1.0000
% Find the standard deviations of each variable X
psigma = std(X)
% psigma =
% 26.5714 6.7128 6.9325
% Find the covariance matrix between variables X:
pcov = covcorr(psigma,prho)
% pcov =
% 706.0404 27.7879 41.0202
% 27.7879 45.0622 23.8194
% 41.0202 23.8194 48.0590

引用格式

Gregory Pelletier (2024). Covariance from standard deviation and correlation (covcorr) (https://www.mathworks.com/matlabcentral/fileexchange/158046-covariance-from-standard-deviation-and-correlation-covcorr), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2023b
兼容任何版本
平台兼容性
Windows macOS Linux
标签 添加标签

Community Treasure Hunt

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

Start Hunting!
版本 已发布 发行说明
1.0.3

updated title

1.0.2

updated readme

1.0.1

updated readme

1.0.0