help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Comments on pwelch.m


From: Joe Koski
Subject: Comments on pwelch.m
Date: Sun, 07 Nov 2004 17:37:01 -0700
User-agent: Microsoft-Entourage/11.0.0.040405

I recently replaced my 20+ year-old Fortran 77-based power spectrum program
with an octave-forge based equivalent. It took far less time to implement
than the Fortran did, and gives identical (to the naked eye, at least) plots
for the test cases that I ran. The octave routines are also much less fussy
about setting the number of data points analyzed to be powers of 2.

Some minor comments:

The variable w that returns from pwelch.m is not defined in either the
on-line help or in http://octave.sourceforge.net/index/index.html. It
appears (from experiment) to be frequency in Hz. The MATLAB equivalent
claims (in their help file) to return w as frequency in radians/s. This
would make w more appropriate, being an approximation of the lower case
omega commonly used for frequency in radians/s.

The window used for the octave-forge pwelch.m is the Hanning window. The
MATLAB equivalent claims to use the Hamming window (my favorite). No big
deal, but it would be easy to get confused while converting .m scripts back
and forth.

When I just used three input variables, e. g.,

[Px,w] = pwelch(x,512,sample_rate);

the variable Px came back as complex (I was expecting reals, and that the
abs function would have already be done.) It also appears to be 'squared'
output rather than 'db', because I had to apply 10*log10(abs(Px')) to get
the correct output magnitude in db. I think most users would expect the 'db'
option to be standard, but I'm no expert. When I tried specifying more
arguments to pwelch.m, I started having debugging problems, and went back to
what I already had working.

Treating the data set as a transient (periodogram) via fft.m worked without
problems. I didn't look for a periodogram.m function that may already exist.

No major problems to report, only some things to consider the next time the
help files or pwelch are updated.

Everything works. Any comments?

Joe






-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]