Generate a matrix from linearly spaced vector

1 回表示 (過去 30 日間)
Kash022
Kash022 2017 年 5 月 8 日
回答済み: KSSV 2017 年 5 月 8 日
Hello,
I have the following line of code which generates a linearly spaced vector. How do I change it to a matrix of size m-by-n so that I can perform cov(log_sigma)? (covariance of noise matrix)
log_sigma=linspace(-2,2,30);
Thanks

採用された回答

KSSV
KSSV 2017 年 5 月 8 日
doc reshape
N = 30 ;
log_sigma=linspace(-2,2,N);
m = 5 ; n = 6 ;
if m*n ~=N
disp('you cannot reshape')
break
else
iwant = reshape(log_sigma,m,n)
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by