DSPRelated.com
Forums

Questions regarding Octave

Started by Eric Jacobsen March 23, 2008
Eric,

   Sending you the working code back again,

%------------------------------ modified code start
% 5/1/96 Eric Jacobsen
%
% Design a butterworth filter and determine the equivalent FIR taps.
%

order=4; % Order of filter.
cutoff=0.25; % Cutoff relative to 1.0 = 1/2 sample rate.

[B,A]=butter(order,cutoff);

%---------------- removed "end;" line (not required) --

Regards
Bharat Pathak
Eric,

   Sending you the working code back again,

%------------------------------ modified code start
% 5/1/96 Eric Jacobsen
%
% Design a butterworth filter and determine the equivalent FIR taps.
%

order=4; % Order of filter.
cutoff=0.25; % Cutoff relative to 1.0 = 1/2 sample rate.

[B,A]=butter(order,cutoff);

%---------------- removed "end;" line (not required) --

Regards
Bharat Pathak
Eric Jacobsen <eric.jacobsen@ieee.org> writes:

> On Sun, 23 Mar 2008 22:29:23 -0400, Randy Yates <yates@ieee.org> > wrote: > >>Hi Eric, >> >>There is an octave newsgroup: >> >> comp.soft-sys.octave > > Ah, thanks. Now the mystery is why the group search in Free Agent > didn't find that... > >>There is also an IRC channel on freenode.net called #octave. >> >>Regarding your error, would it be possible for you to post the code? I >>can't help too much just based on what you wrote. > > It seems to be code independent and somehow associated with the file. > It appears to be complaining about some mysterious whitespace marker > or something, and since in the one example it's complaining about a > line well past the end of the file the code probably has nothing to do > with it. > > Nevertheless, try this: > _________________________________ > % > % 5/1/96 Eric Jacobsen > % > % Design a butterworth filter and determine the equivalent FIR taps. > % > > order=4; % Order of filter. > cutoff=0.25; % Cutoff relative to 1.0 = 1/2 sample rate. > > [B,A]=butter(order,cutoff); > > end; > > ___________________ > > That's an ancient file that I had laying around that's small and > exhibits the problem. For this one it says > > error: 'buttgen' undefined near line 60 column 1 > > Well, the file only has 13 lines. Grrr.
Yeah, but isn't the function name of the function generating the error somewhere? I think I found the error. You need to install octave-forge, which is a lot of the functionality provided by what we consider mainstream Matlab. I thought they had merged this into the main install for octave 3.0.0, but apparently not - i didn't have "butter()" defined when I first tried your snippet. After installing octave-forge, it ran without error (after removing the extraneous "end" as Bharat noted). -- % Randy Yates % "I met someone who looks alot like you, %% Fuquay-Varina, NC % she does the things you do, %%% 919-577-9882 % but she is an IBM." %%%% <yates@ieee.org> % 'Yours Truly, 2095', *Time*, ELO http://www.digitalsignallabs.com
On Sun, 23 Mar 2008 22:53:27 -0500, "bharat pathak"
<bharat@arithos.com> wrote:

>Eric, > > Sending you the working code back again, > >%------------------------------ modified code start >% 5/1/96 Eric Jacobsen >% >% Design a butterworth filter and determine the equivalent FIR taps. >% > >order=4; % Order of filter. >cutoff=0.25; % Cutoff relative to 1.0 = 1/2 sample rate. > >[B,A]=butter(order,cutoff); > >%---------------- removed "end;" line (not required) -- > >Regards >Bharat Pathak
Thanks to everybody for the attention so far. It's evidently file related, as I copied this back into a new file and it ran fine. I took the 'end;' out of the old file (which was legal matlab syntax back in the day when the file was created), and it still exhibited the 'undefined' problem. I copied only the executable lines out of the old file into a new file and it ran okay, too. So there's something creeping into the files that causes this undefined problem, but I'll be damned if I can sort out what it is. FWIW, I've created a few new files (actually trying to get some work done), and they have the "undefined" problem as well. So while I can get a few examples of some very small code snippets working, I can't get any real work done. Also, FWIW, I've yet to find any of my existing library of Matlab files that -don't- exhibit this "undefined" problem. To recap what I've tried: All tested examples of previously existing m files exhibit the problem. Most examples of newly written programs exhibit the problem. A few examples of very small new programs don't exhibit the problem. Copying three executable lines out of a problematic file into a new one didn't exhibit the problem. Other attempts at copying executable lines into new files did exhibit the problem. Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org
"Eric Jacobsen" schrieb
> > It's evidently file related, as I copied this back into > a new file and it ran fine. I took the 'end;' out of > the old file [...] >
Could there be a CR/LF vs CR problem (linux to Windows file transfer)? If you open the file in Notepad and all lines show as only one line, then you have a file that follows the Unix file convention (CR or LF only, I keep forgetting which one it is). Open it in Wordpad, save it again and from then it should show up also in Notepad correctly. This is a long shot, I don't know whether Octave is susceptible to this type of issue. YMMV. Martin
On Mar 23, 11:11 pm, dbd <d...@ieee.org> wrote:
> On Mar 23, 7:49 pm, robert bristow-johnson <r...@audioimagination.com> > wrote: > > > ... > > yer not the only one, after all it seems intended to be a gnu freeware > > counterpart to MATLAB. i contacted Eaton (and got on the Octave > > developer's list for a little while) to propose they do to Octave what > > i have, for more than a decade, been trying to get MATLAB to do: > > generalize handling array indices so that an array can have non- > > positive integer indices; so that the indices of the upper-left corner > > need not always be (1,1). > > > fell on deaf ears. > > > r b-j > > So, doesn't that make Octave an accurate counterpart to MATLAB? > > But, in the spirit of GNU freeware, what did they say when you offered > to implement the change for them?
i can't do it all by myself. i downloaded the whole code base, even got it to build on my Linux machine, but i could not, for the life of me, figure out specifically where they were doing their index calculations. specifically, for arrays of two dimensions or more, the *must* be subtracting 1 from the index and multiplying it by the row length (or, in MATLAB/Octave i think it's the column length) and adding that to the "less significant" index where either they subtract one and add it to the array base address, or they don't bother to subtract 1 and the base address is fudged by 1. also this should be intimately related to the index bounds checking that either MATLAB or Octave do. i can't find that and no one who was a regular developer would help me because (like the Math Works) they didn't think that this modification was a good thing to do which is still just inexplicable to me. the Octave source code is spaghetti. it's shit. i cannot believe that people take any pride in code written like that. (well, i dunno, i see a lot of shit code where i work.) r b-j
On Mar 23, 11:11 pm, dbd <d...@ieee.org> wrote:
> On Mar 23, 7:49 pm, robert bristow-johnson <r...@audioimagination.com> > wrote: > > > ... > > yer not the only one, after all it seems intended to be a gnu freeware > > counterpart to MATLAB. i contacted Eaton (and got on the Octave > > developer's list for a little while) to propose they do to Octave what > > i have, for more than a decade, been trying to get MATLAB to do: > > generalize handling array indices so that an array can have non- > > positive integer indices; so that the indices of the upper-left corner > > need not always be (1,1). > > > fell on deaf ears. > > > r b-j > > So, doesn't that make Octave an accurate counterpart to MATLAB? > > But, in the spirit of GNU freeware, what did they say when you offered > to implement the change for them?
i can't do it all by myself. i downloaded the whole code base, even got it to build on my Linux machine, but i could not, for the life of me, figure out specifically where they were doing their index calculations. specifically, for arrays of two dimensions or more, the *must* be subtracting 1 from the index and multiplying it by the row length (or, in MATLAB/Octave i think it's the column length) and adding that to the "less significant" index where either they subtract one and add it to the array base address, or they don't bother to subtract 1 and the base address is fudged by 1. also this should be intimately related to the index bounds checking that either MATLAB or Octave do. i can't find that and no one who was a regular developer would help me because (like the Math Works) they didn't think that this modification was a good thing to do which is still just inexplicable to me. the Octave source code is spaghetti. it's shit. i cannot believe that people take any pride in code written like that. (well, i dunno, i see a lot of shit code where i work.) r b-j
On Mar 23, 11:11 pm, dbd <d...@ieee.org> wrote:
> On Mar 23, 7:49 pm, robert bristow-johnson <r...@audioimagination.com> > wrote: > > > ... > > yer not the only one, after all it seems intended to be a gnu freeware > > counterpart to MATLAB. i contacted Eaton (and got on the Octave > > developer's list for a little while) to propose they do to Octave what > > i have, for more than a decade, been trying to get MATLAB to do: > > generalize handling array indices so that an array can have non- > > positive integer indices; so that the indices of the upper-left corner > > need not always be (1,1). > > > fell on deaf ears. > > > r b-j > > So, doesn't that make Octave an accurate counterpart to MATLAB? > > But, in the spirit of GNU freeware, what did they say when you offered > to implement the change for them?
i can't do it all by myself. i downloaded the whole code base, even got it to build on my Linux machine, but i could not, for the life of me, figure out specifically where they were doing their index calculations. specifically, for arrays of two dimensions or more, the *must* be subtracting 1 from the index and multiplying it by the row length (or, in MATLAB/Octave i think it's the column length) and adding that to the "less significant" index where either they subtract one and add it to the array base address, or they don't bother to subtract 1 and the base address is fudged by 1. also this should be intimately related to the index bounds checking that either MATLAB or Octave do. i can't find that and no one who was a regular developer would help me because (like the Math Works) they didn't think that this modification was a good thing to do which is still just inexplicable to me. the Octave source code is spaghetti. it's shit. i cannot believe that people take any pride in code written like that. (well, i dunno, i see a lot of shit code where i work.) r b-j
On Mon, 24 Mar 2008 09:56:13 -0700 (PDT), robert bristow-johnson
<rbj@audioimagination.com> wrote:

>the Octave source code is spaghetti. it's shit. i cannot believe >that people take any pride in code written like that. (well, i dunno, >i see a lot of shit code where i work.)
I'm sure your 10K+ lines of opensource code looks much better. Where can we download it to study it?
On Mon, 24 Mar 2008 17:38:57 +0100, "Martin Blume"
<mblume@freesurf.ch> wrote:

>"Eric Jacobsen" schrieb >> >> It's evidently file related, as I copied this back into >> a new file and it ran fine. I took the 'end;' out of >> the old file [...] >> > >Could there be a CR/LF vs CR problem (linux to Windows >file transfer)? > >If you open the file in Notepad and all lines show as only >one line, then you have a file that follows the Unix file >convention (CR or LF only, I keep forgetting which one it is). >Open it in Wordpad, save it again and from then it should show >up also in Notepad correctly. > >This is a long shot, I don't know whether Octave is susceptible >to this type of issue. > >YMMV. >Martin
Well, I tried that and resaving it with either Wordpad or Word didn't make any difference. HOWEVER, somewhere along the way of porting all this crap across numerous machines (all Windows-based, btw), the filename and extension became all caps, i.e., BUTTGEN.M. So I renamed the file to buttgen.m and PRESTO! It works. Jeebuz. So I changed the name of another, more complex file, from all upper case to all lower case and that runs and generates a nice plot of a spectrum (I'm guessing that's what it's supposed to do, it's another really old file). In any case, it didn't generate an 'undefined' error and it did previously when I tried that same file in Octave. This doesn't explain why some of the new files I created were problematic, but I'll poke around some more and see what I can sort out. Progress in any case, even in the right direction! ;) Eric Jacobsen Minister of Algorithms Abineau Communications http://www.ericjacobsen.org