Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Prediction with ARMAX

Subject: Prediction with ARMAX

From: Mehmet Demirel

Date: 19 Feb, 2009 15:10:18

Message: 1 of 2

Question is about data introduction to armax: M is a two column matrix containing output (y) and input (u) time series. Each row is the measurement of the same day, no day shift. Desired model structure with a lead time of 7 days;
y(t) = B(q)u(t-7) + C(q)e(t)

Do i need to introduce the data with a 7 row shift like this (target starts at 8th day);
Input_calib =M(1:7664,2)
Target_calib=M(8:7671,1);

Or it is not necessary as i can set Armax parameter "nk" as 7 for the same purpose?

zcalib = iddata(y,u); %y output, u input
Armafit = armax(zcalib,'na',0,'nb',1,'nc',1,'nk',7);
Results:
y(t) = B(q)u(t) + C(q)e(t)
B(q) = 0.7437 (+-0.009438) q^-7
C(q) = 1 + 0.873 (+-0.007281) q^-1

Second part of my question;
To make a realisation of the model in validation part;

predict(Armafit,zvalid,inf) or predict(Armafit,zvalid,7) should be selected?

I think first one should be used according to this information available at the link below..
YP = PREDICT(Z,TH,M)
M = inf gives a pure simulation of the system.(Default M=1).

But i am still not sure with lead time if it becomes 7+1 and 8 days since default m is one...
Ref: http://jisao.washington.edu/vimont_matlab/System/predict.html

Cheers,
mehmet, loves knowledge share

Subject: Prediction with ARMAX

From: Rajiv Singh

Date: 23 Feb, 2009 14:39:44

Message: 2 of 2

Hi Mehmet,
Your model structure selection should primarily be guided by your knowldge
of (or desire to capture) the underlying dynamics. For example, choose 'nk'
based on what the perceived delay in the model is, and not based on how far
in future you want to forecast result.

So I would not advice shifting data or setting 'nk' to 7. Instead, try out
various model orders (low to high) and use the one that seems to provide the
best fit to your data. This can be ascertained using COMPARE function. For
example, you can check how well your model simulates (M = Inf) or how well
it performs 7 step-ahead prediction (M=7):
COMPARE(DATA, MODEL, M)

What prediction horizon to use in COMAPRE or PREDICT depends upon how you
intend to use the model. If you are using model always to forecast results
using I/O data collected under similar settings (similar noise/disturbance
profile), then you could just validate your model using M = 7. However, if
you are interested in checking how well the underlying dyanamics have been
captured (which is a more severe validation test than finite horizon
prediction), use M = Inf.

This is what I do usually: I generate a bunch of candiate models (various
types and orders) and use M = Inf in COMPARE to check how well they fit a
validation data set. Then I select the one which provides the best fit while
not using too high orders. I then use the model as required for prediction
or simulation.

HTH,
Rajiv

"Mehmet Demirel" <mecudem@yahoo.com> wrote in message
news:gnjsoq$9ld$1@fred.mathworks.com...
> Question is about data introduction to armax: M is a two column matrix
> containing output (y) and input (u) time series. Each row is the
> measurement of the same day, no day shift. Desired model structure with a
> lead time of 7 days;
> y(t) = B(q)u(t-7) + C(q)e(t)
>
> Do i need to introduce the data with a 7 row shift like this (target
> starts at 8th day);
> Input_calib =M(1:7664,2)
> Target_calib=M(8:7671,1);
>
> Or it is not necessary as i can set Armax parameter "nk" as 7 for the same
> purpose?
>
> zcalib = iddata(y,u); %y output, u input
> Armafit = armax(zcalib,'na',0,'nb',1,'nc',1,'nk',7);
> Results:
> y(t) = B(q)u(t) + C(q)e(t)
> B(q) = 0.7437 (+-0.009438) q^-7
> C(q) = 1 + 0.873 (+-0.007281) q^-1
>
> Second part of my question;
> To make a realisation of the model in validation part;
>
> predict(Armafit,zvalid,inf) or predict(Armafit,zvalid,7) should be
> selected?
>
> I think first one should be used according to this information available
> at the link below..
> YP = PREDICT(Z,TH,M)
> M = inf gives a pure simulation of the system.(Default M=1).
>
> But i am still not sure with lead time if it becomes 7+1 and 8 days since
> default m is one...
> Ref: http://jisao.washington.edu/vimont_matlab/System/predict.html
>
> Cheers,
> mehmet, loves knowledge share

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us