Generate a matrix from linearly spaced vector

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일

1 개 추천

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개)

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

질문:

2017년 5월 8일

답변:

2017년 5월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by