You are indeed correct as to the coding issue. As to Peter's suggestion, I
would disagree with it for two reasons: 1) Its called a unit step function,
so to have it step more than once seems misleading to me. Possibly the
function he is suggesting should simply be called step or similar.
2) His code is based on the postion inside the vector, not the values
contained within the vector. Maybe that sort of unit step function could
also come under a different name.
I like the way my function is coded for reasons previously listed (and as
Soren has simplified), and that I can simply create a numbered vector as
such:
n=-3:5;
and regardless of the start and end values, the step function will 'step'
when n=0 or any other specified time (that may even be outside the range of
the vector).
x = ustep(n,2) in previous example returns:
x = [0 0 0 0 0 1 1 1 1]
I accept Soren's simplification suggestions, but it will take me a little
while (approx. a week) to change things (as well as this documentation
suggestion) as I am going to have a very busy weekend doing uni work.
Lyle
On Wed, Aug 12, 2009 at 00:12, Søren Hauberg <[email protected]> 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.
>
> Søren
>
>
>
------------------------------------------------------------------------------
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