how can i generate a moving average time series data using amtalb R 2006 a?
조회 수: 1 (최근 30일)
이전 댓글 표시
i want to generate moving average time series data , i used a the function armasim
function z = armasim(phi,theta,n)
% ARMASIM(PHI,THETA,N) generates N observations from the
% ARMA model specified by PHI, THETA
% It "burns in" with the 1st 200 observations
[p m] = size(phi);
[q m] = size(theta);
n1 = 200+n;
a = normrnd(0,1,n1+q,1);
z = zeros(p,1);
for i=1:n1
zt = z(i:(i+p-1))'*phi(p:-1:1)+a(i+q)-a(i:(i+q-1))'*theta(q:-1:1);
z = [ z ; zt ];
end
z = z((201+p):(n1+p));
it works good for MA(1) but MA(2)or more , the resulting data is not good!
댓글 수: 0
답변 (1개)
Image Analyst
2013년 5월 15일
To do a moving average, use conv():
movingAverage = conv(inputSignal, ones(1, windowSize)/windowSize);
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Biological and Health Sciences에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!