From help-octave-request at bevo dot che dot wisc dot edu Fri Dec 26 22:17:08 2003 Subject: Syntax befuddlement From: Joe Koski To: Date: Fri, 26 Dec 2003 21:14:16 -0700 I'm trying to use a MatLab routine that I found on the net for calculating instantaneous local frequency after a Hilbert transform. The hilbert.m routine (called from octave-forge) completes successfully. The amplitude of the signal is correctly calculated from the results. In attempting to calculate frequency and convert the remainder of the MatLab routine to octave, I get errors during execution terminating with: error: invalid vector index = -1 The statement that is being evaluated at the time of the error is fnormhat=0.5*(angle(-x(t+1).*conj(x(t-1)))+pi)/(2*pi); where x is a real column vector (representing data) of length 256, and t is a real row vector (representing time "instants," but with the first and last values truncated) of length 254. When I try this with the --braindead option, the routine gives no errors, but then no results are returned, either. The date on this script is 1994 and it's currently posted on the web, so it probably really does work in MatLab. As an old Fortran programmer, the statement syntax seems very strange to me. My questions: How can one real array with increments (t+1, t-1) be an index for another real array (x)? Or does that indicate a functional relationship? Is this standard octave? Are there tricks for getting MatLab scripts like this to execute correctly in octave? Alternatively, are there an equivalent octave-forge routines that would avoid the problem? If it would help, I could include more of the routine. Thanks. Joe Koski ------------------------------------------------------------- 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 -------------------------------------------------------------