Simulating MA(1) process: Assertion failed
Show older comments
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
Answers (0)
Categories
Find more on App Building in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!