I'm adapting MATLAB code to R and trying to generate a waveform using ARMA formula. Is there a simple R equivalent function for MATLAB's filter
to take AR/MA coefficients to build a waveform?
npts = 100;
a = [1 0.6]; % AR coeffs
b = [1 0.25 3]; % MA coeffs
e = randn(npts,1); % generate gaussian white noise
waveform = filter(b,a,e); % generate waveform
Yeah, you can do this usring arima.sim
, eg
arima.sim(npts, model=list(ar=a, ma=b), rand.gen=rnorm)
Note that the model is checked for stationarity and the model you have above is not stationary. If you want something integrated you can specify the order of integration in the model.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.