Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Problem Writing an Autoregressive Process Function

조회 수: 2 (최근 30일)
Roger Kimsky
Roger Kimsky 2017년 12월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
I need to create a function that can realize an autoregressive process given three parameters: length(N), standard deviation(sigma), and a vector of coefficients (a).
I know that from the definition of an autoregressive process: x[n]+ a[1]x[n −1]+ a[2]x[n −2]+...+ a[M]x[n − M] = v[n]
Or, in other words: x[n] = -a[1]x[n −1] - a[2]x[n −2] - ... + -a[M]x[n − M] + v[n]
I can use the standard deviation input to create white Gaussian noise with a given variance by multiplying the randn function by it, which will be the v[n] term. However, I'm having trouble figuring out how to create the function since x[n] depends on previous inputs of itself and it can't be an input to the function. As such, I don't know what to do about the x[n-1], x[n-2], etc. terms in the second equation. Does anyone know how to go about doing this? With this issue solved, I can easily figure the rest out on my own. Thanks a lot!

답변 (1개)

Michelangelo Ricciulli
Michelangelo Ricciulli 2017년 12월 10일
Hello Roger,
First I suppose the length N, is the output vector length. Right? Let's say your initial index is 1. Thus, samples before x[1] (i.e., x[0] x[-1] ... x[1-M]) can be simply considered 0 (or, if you prefer, they could be passed as an argument of the function). Then, the first sample of the vector x can be computed as,
x[1]=v[1];
At the next step, you can use x[1] since you just computed its value. So,
x[2]=a[1]*x[1]+v[2];
Then,
x[3]=a[1]*x[2]+a[2]*x[1]+v[3];
And so on and so forth. Of course, you'll need to implement these steps programmatically.

이 질문은 마감되었습니다.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by