File: arma1.dem

package info (click to toggle)
scilab 2.4-1
  • links: PTS
  • area: non-free
  • in suites: potato, slink
  • size: 55,196 kB
  • ctags: 38,019
  • sloc: ansic: 231,970; fortran: 148,976; tcl: 7,099; makefile: 4,585; sh: 2,978; csh: 154; cpp: 101; asm: 39; sed: 5
file content (41 lines) | stat: -rw-r--r-- 1,128 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//
// An example of arma simulation and identification 
// form ( K.J. Astrom)
// The armax process with the following characteristics 
//    a=[1,-2.851,2.717,-0.865]
//    b=[0,1,1,1]
//    d=[1,0.7,0.2]
// is simulated with an input u of a pseudo random binary type
//
// We use the simulated trajectory zd
// as an input to the armax identification macro 
// The noise in the armax is coloured and armax 
// will give a biaised estimator 

// Copyright INRIA
a=[1,-2.851,2.717,-0.865]
b=[0,1,1,1]
d=[1,0.7,0.2]
ar=armac(a,b,d,1,1,1);
write(%io(2),"Simulation of an ARMAX process:");
ar
// The input
n=300;
u=-prbs_a(n,1,int([2.5,5,10,17.5,20,22,27,35]*100/12));
// simulation 
zd=narsimul(ar,u);
xselect();xbasc();
plot2d2("enn",1,zd',[1,1],"121","Simulated output");
plot2d2("enn",1,1000*u',[3,4],"100","Input [scaled]");
halt();
write(%io(2),"Identification ARX (least square):");
[arc,la,lb,sig,resid]=armax(3,3,zd,u,1,1);
arc
halt();
// using now armax1 : coloured noise idsentification 
// you can test the same example with 
// n=1000; u=rand(1,n,'g') zd=narsimul(ar,u);
[arc1,resid]=armax1(3,3,2,zd(1:n),u,1);
arc1