Simulating MA(1) process: Assertion failed

Hi all,
I am required to solve the following exercise:
Write a function that simulates an MA(1) process. The function should take the following input parameters (in this order):
  • theta (MA parameter)
  • sigma (standard deviation of innovations)
  • epsilon0 (starting value)
  • T (total length of the time series to simulate)
The result should be a Tx1 column vector.
The code to call is:
path = simulateMA1(0.9, 0.1, 0, 100)
and the function I created is:
function y = simulateMA1(theta, sigma, epsilon0, T)
y(1)=epsilon0;
for k=2:T
epsilon0(k)=sigma*randn;
y(k)=epsilon0(k)+theta*epsilon0(k-1) ;
end
y=y.'
end
However, after calling the function in Cody Coursework it states "Assertion failed". Since I'm obtaining the Tx1 column vector, I can't figure out the error.
I appreciate any help.
Best,
Kay

Réponses (0)

Catégories

En savoir plus sur App Building dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by