stochasticMatrixPro​jection(A,projectio​n_type)

版本 1.3.0.0 (2.6 KB) 作者: Lior Kirsch
Finds the closest stochastic matrix
169.0 次下载
更新时间 2015/5/23

查看许可证

Given a matrix A it finds the closest matrix which is column stochastic (left stochastic matrix ).
This is based on vector implementation in http://www.mathworks.com/matlabcentral/fileexchange/30332-projection-onto-simplex which is based on the paper http://arxiv.org/abs/1101.6081
Two type of projections are supproted:
1. "on simplex" - Each entry is in [0,1] and each columns sums to one.
2. "inside simplex" - Each entry is in [0,1] and each columns sum is also in [0,1]
input:
A - matrix, which columns to project
projection_type - which type of projection to make:
'on' - on the simplex, each column sums to one (default)
'inside' - inside the simplex, each column sum is in the interval[0,1]
example:
vec_2d = rand(2,200)*3 - 1;
proj_vec = stochasticMatrixProjection(vec_2d,'on');
subplot(1,2,1);
plot([vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],...
[vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],'.'); axis equal
subplot(1,2,2);
proj_vec = stochasticMatrixProjection(vec_2d,'inside');
plot([vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],...
[vec_2d(1,:);proj_vec(1,:)],[vec_2d(2,:);proj_vec(2,:)],'.'); axis equal

引用格式

Lior Kirsch (2024). stochasticMatrixProjection(A,projection_type) (https://www.mathworks.com/matlabcentral/fileexchange/50779-stochasticmatrixprojection-a-projection_type), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2014b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Polynomials 的更多信息
致谢

参考作品: Projection onto simplex

Community Treasure Hunt

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

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

Replaced repmat with bsxfun

1.2.0.0

Example added.

1.1.0.0

* added text to the description

1.0.0.0