On Tue, Aug 11, 2009 at 04:12:55PM +0200, Søren Hauberg wrote: > tir, 11 08 2009 kl. 23:05 +1000, skrev Lyle Collins: > > Maybe I'm missing something, but I think with your code, the output > > only responds to the position in the vector, not the value within the > > position in the vector > > I don't quite understand. Could you send an example where your code > behaves differently from the stuff I posted? > > > I will admit I'm a beginner when it comes to octave. I wrote these > > functions as a student studying telecommunications, and just wanted a > > simple way to create a unit step/pulse/ramp response. Obviously I > > don't have the indepth knowledge of all you developers, but I think > > that these functions will be beneficial to those trying to learn > > octave/telecommunications if for no other reason than they have the > > name of the function I was looking for. > > I don't object to adding these function, although I would like to hear > from users of the 'signal' package if the functions are of general use. >
pulse, step, and ramp are classical input signals for control theory and signal processing; so I suggest that they would be useful. I would be happy to see these functions added. I would like to see the "for" loops removed. Also, I think each of these functions would benefit from a documentation string which 1) clearly states the purpose, and 2) defines the input (arguments) and output (return values), as recommended in the octave manual: http://www.gnu.org/software/octave/doc/interpreter/Function-Headers.html So far, we can only guess the purpose from the function name. Also, I suggest that the first argument be the length of the output vector, like the gausswin and kaiser window functions. function output = upulse( N, istart ) ## ## Makes a single impulse signal or a pulse-train signal. ## ## N = (scalar) length of output vector, ## istart = (vector or scalar) optional list of array indices at which ## the output signal "restarts". Default: istart=1. ## ## example; ## upulse( 9, [2 6]) ## ==> 0 1 0 0 0 1 0 0 0 Other suggestions: function output = ustep( N, istart ) ## ## Makes a single step or a staircase. ## ## example; ## ustep( 9, [2 6]) ## ==> 0 1 1 1 1 2 2 2 2 output = cumsum( upulse( N, istart ) ) endfunction function output = uramp( N, istart ) ## ## Makes a ramp or a sawtooth. ## ## example; ## upulse( 9, [2 6]) ## ==> 0 0 1 2 3 0 1 2 3 ... ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
