help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unit sample sequence ->step


From: NZG
Subject: Re: unit sample sequence ->step
Date: Sun, 6 Feb 2005 16:26:23 -0600
User-agent: KMail/1.7.1

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
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]