~ubuntu-branches/ubuntu/karmic/scilab/karmic

« back to all changes in this revision

Viewing changes to demos/arma/arma3.dem

  • Committer: Bazaar Package Importer
  • Author(s): Torsten Werner
  • Date: 2002-03-21 16:57:43 UTC
  • Revision ID: james.westby@ubuntu.com-20020321165743-e9mv12c1tb1plztg
Tags: upstream-2.6
ImportĀ upstreamĀ versionĀ 2.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Spectral power estimation 
 
2
// ( form Sawaragi et all) 
 
3
// Copyright INRIA
 
4
m=18
 
5
a=[1,-1.3136,1.4401,-1.0919,+0.83527]
 
6
b=[0.0,0.13137,0.023543,0.10775,0.03516]
 
7
u=rand(1,1000,'n');
 
8
z=arsimul(a,b,[0],0,u);
 
9
//----Using macro mese 
 
10
[sm,fr]=mese(z,m);
 
11
//----The theorical result 
 
12
deff('[gx]=gxx(z)',['gx=(abs( a* exp(-%i*2*%pi*z*(0:4))'')**2)';...
 
13
      'gx=abs( b* exp(-%i*2*%pi*z*(0:4))'')**2/gx']);
 
14
res=[];
 
15
for x=fr,res=[ res, gxx(x)];end;
 
16
//----using armax estimation of order  (4,4)
 
17
// it's a bit tricky because we are not supposed to know the order
 
18
//
 
19
[arc,la,lb,sig,resid]=armax(4,4,z,u);
 
20
a=la(1);
 
21
b=lb(1);
 
22
res1=[];
 
23
for x=fr,res1=[ res1, gxx(x)];end;
 
24
//
 
25
leg="log(p) :using macro mese @ theoriqal value@log(p) : arma identifcation"
 
26
halt();
 
27
xbasc();
 
28
xtitle('Spectral power','frequency','spectral estimate')
 
29
plot2d([fr;fr;fr]',[20*log(sm/sm(1))/log(10);...
 
30
  20*log(res/res(1))/log(10);...
 
31
  20*log(res1/res1(1))/log(10)]',...
 
32
 [2,1,-1],"111",leg, [0,-70,0.5,60]);
 
33
 
 
34
 
 
35
 
 
36