help-octave
[Top][All Lists]
Advanced

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

Re: impulse function


From: brito\.rn
Subject: Re: impulse function
Date: Tue, 7 Aug 2007 15:26:42 -0300

Hi James, thanks for your response.

I will try to explain better.

I need to plot a discrete-time signal which contains impulse responses. This 
signal is a sequence of 26 (0 to
25) samples that each one contain an accumulator of m from 0 to 10. 

The signal is represented by this sequence:
x[n] = accum((m+1)*[impulse(n-2m)-impulse(n-2m-1)]), with n = 0:25 and m = 0:10;

For exemple, if x[n] when n = 0, x[0] = 
accu((m+1)*[impulse(0-2m)-impulse(0-2m-1)]) with m from 0 to 10.

Octave has a function impulse(), but this function need a system data scruture 
and I dont know how I can
convert my sequence for this data type.

Sorry about my english, is not my primary language.

Brito.


---------- Cabeçalho original -----------

De: address@hidden
Para: "brito.rn" address@hidden
Cópia: "help-octave" address@hidden
Data: Tue, 7 Aug 2007 11:27:56 -0400
Assunto: Re: impulse function

> I'm a bit confused by your code here:
> 
> for n = 0:25
>        for m = 0:10
>                x(n) = (m+1)*(impulse(n-(2*m))-impulse(n-(2*m)-1));
>        endfor;
>        plot(x(n));
> endfor;
> 
> First off, I think you can just implement the impulse function using just ==
> 
> (i.e. impulse(n) = 1 if and only if n = 0, otherwise = 0)
> and secondly, you're not performing any summation in the m loop, you're
> essentially assigning x(n) the value when m = 10 (the last value in the
> loop).
> 
> What I think you want is this:
> first, define imp as:
> ------
> function x = imp(n)
> 
> if n == 0,
>   x = 1;
> else
>   x = 0;
> end
> 
> return
> ------
> 
> Then, your loop would look something like:
> ------
> x = zeros(1,26);
> index = [0:25];
> 
> for n = index
>   for m = 0:10
>     x(n+1) = x(n+1) + (m+1)*(imp(n-(2*m))-imp(n-(2*m)-1));
>   end
> end
> plot(index, x);
> -------
> 
> At least, I think this is what you're going for.
> 
> James Sherman
> 
> 
> On 8/7/07, brito.rn <address@hidden> wrote:
> >
> > Hi,
> >
> > I need to plot a sequence of samples of a equation that has impulses.
> >
> > The sequence is here:
> > x[n] = sum((m+1)*[impulse(n-2m)-impulse(n-2m-1)]), with the sum of m from
> > 0 to 10 and n from 0 to 25.
> >
> > A simple code for that can be:
> >
> > for n = 0:25
> > for m = 0:10
> > x(n) = (m+1)*(impulse(n-(2*m))-impulse(n-(2*m)-1));
> > endfor;
> > plot(x(n));
> > endfor;
> >
> > but, the problem is: the imput impulse function format is sys type. I
> > don't have idea about how I can use this
> > sys format for my equation.
> >
> > I need help about how I can plot that sequence with impulses.
> >
> > regards,
> >
> > Brito.
> >
> >
> > _______________________________________________
> > Help-octave mailing list
> > address@hidden
> > https://www.cae.wisc.edu/mailman/listinfo/help-octave
> >
> 
> 




reply via email to

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