How to calculate moving standard deviation in a matrix?
이전 댓글 표시
Hi Guys, I have got a matrix :378x9. I need to calculate the moving standard deviation with a window size of 180(starting from row one). Can somebody help me please?
답변 (1개)
Manolis Michailidis
2015년 10월 13일
0 개 추천
댓글 수: 7
Andrea Finocchiaro
2015년 10월 13일
Manolis Michailidis
2015년 10월 13일
편집: Manolis Michailidis
2015년 10월 13일
what errors do you get discribe them please and write your code
Manolis Michailidis
2015년 10월 13일
편집: Manolis Michailidis
2015년 10월 13일
Here i made a try and it works fine
X= [randi(10,1000,1) randi(100,1000,1)]; %create random matrix wit 2 columns
for kk=1:size(X,2)
s(:,kk)=movingstd(X(:,kk),180,'f');
end
also consider in mind that in this example i compute the moving std per column , also you can make it work for each row. Just replace size(X,2) with size(X,1) and s(:,kk) , X(:,kk) with s(kk,:), X(kk,:) .
Andrea Finocchiaro
2015년 10월 13일
Manolis Michailidis
2015년 10월 13일
편집: Manolis Michailidis
2015년 10월 13일
You don't have to type all this in command window, look at the function syntax , first variable is you matrix (lets say X) , next is moving window length (180) and finally optional parameter is 'f' forward. You have already the function why don't you call it?
Andrea Finocchiaro
2015년 10월 13일
Manolis Michailidis
2015년 10월 13일
편집: Manolis Michailidis
2015년 10월 13일
for kk=1:size(X,2) % kk is your column index
s(1:180,kk)=movingstd(X(1:180,kk),180,'f');
end
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!