MATLAB Answers

## Matlab AR command for creating the model of predicting kstep ahead prediction

Asked by lily

### lily (view profile)

on 16 Jul 2014
Latest activity Commented on by lily

### lily (view profile)

on 20 Jul 2014
Accepted Answer by Shashank Prasanna

### Shashank Prasanna (view profile)

I want to use AR model as a predictor, and for that matlab AR function is used.But there is problem, this function only has the ability to create model for predicting one step ahead directly and for other steps it predicts recursively. If I can use my own pairs of input and output and use the AR it will be solved,but it is not possible for AR function in matlab, because it is capable to have only the time series as an input. IS there any way for solving this problem? Thanks in advance for your suggestions.

#### 0 Comments

Sign in to comment.

## 1 Answer

### Shashank Prasanna (view profile)

Answer by Shashank Prasanna

### Shashank Prasanna (view profile)

on 16 Jul 2014
Accepted Answer

Maybe you are looking for ARX (autoregressive with exogenous inputs). You can fit an ARX model using either the Econometrics or the System Id Toolbox:

#### 4 Comments

Show 1 older comment
Shashank Prasanna

### Shashank Prasanna (view profile)

on 16 Jul 2014
You can specify any number of lags. Take a look at the documentation link and try to run some of the examples, it will be come clear.
lily

### lily (view profile)

on 17 Jul 2014
You are right, I can different lags for both input and output pairs. But my problem is not in number of lags, I want to have model such that:
y(t+2)=a(1)u(t-1)+a(2)u(t-2)+...+a(p)u(t-p)
rather than
y(t)=a(1)u(t-1)+a(2)u(t-2)+...+a(p)u(t-p)
and not:
y(t)+b(1)y(t-1)+b(2)y(t-2)+..=a(1)u(t-1)+a(2)u(t-2)+...+a(p)u(t-p)
My problem is having different step a head output(y(t),y(t+10),..), not lag on it, with the same input pairs.
lily

### lily (view profile)

on 20 Jul 2014
You are right. My problem has been solved. Thanks a lot for your help.

Sign in to comment.