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

« back to all changes in this revision

Viewing changes to macros/signal/mese.sci

  • 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
function [sm,fr]=mese(x,npts);
 
2
//<sm,fr]=mese(x [,npts]);
 
3
//Calculate the maximum entropy spectral estimate of x
 
4
//  x    :Input sampled data sequence
 
5
//  npts :Optional parameter giving number of points of fr and sm
 
6
//        (default is 256)
 
7
//  sm   :Samples of spectral estimate on the frequency grid fr
 
8
//  fr   :npts equally spaced frequency samples in [0,.5)
 
9
//!
 
10
// author: C. Bunks  date: 24 August 1988
 
11
// revised: 9 April 1991
 
12
// Copyright INRIA
 
13
 
 
14
//default evaluation
 
15
 
 
16
   [rhs,lhs]=argn(0);
 
17
   if lhs==1 then,
 
18
      npts=256;
 
19
   end,
 
20
 
 
21
//estimate autocorrelation function of x
 
22
 
 
23
   Nx=length(x);
 
24
   r=convol(x,x(Nx:-1:1))
 
25
   r=r(Nx:-1:1)/Nx;
 
26
 
 
27
//get solution to the Yule-Walker equations
 
28
 
 
29
   [ar,sigma2,rc]=lev(r);
 
30
 
 
31
//compute spectrum
 
32
 
 
33
   ak=[1;ar];
 
34
   [sf,fr]=frmag(ak,npts);
 
35
   sm=sigma2*ones(sf)./(sf.*conj(sf));