From help-request at octave dot org Sun Feb 6 16:23:33 2005 Subject: Re: unit sample sequence ->step From: NZG To: Geordie McBain Cc: help at octave dot org Date: Sun, 6 Feb 2005 16:26:23 -0600 It does, my bad, I meant the unit step. function retval = u(t) for i = 1:length(t) if (t(i) >= 0) retval(i)=1; else retval(i)=0; endif endfor endfunction NZG. On Friday 04 February 2005 12:39 pm, you wrote: > On Thu, Feb 03, 2005 at 09:21:32PM -0600, NZG wrote: > > Is there an easy way to generate vector/matrix representing the unit > > sample sequence in Octave? > > > > thx, > > NZG. > > If "unit sample sequence" means the same as at > > http://www.swarthmore.edu/NatSci/echeeve1/Class/e71/E71L1/E71L1.html > > then it's just u=zeros(1,n); u(d)=1. For example: > > octave> u=zeros (1, 4); u(2)=1 > u = > > 0 1 0 0 > > > Geordie McBain > www.aeromech.usyd.edu.au/~mcbain ------------------------------------------------------------- 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 -------------------------------------------------------------