1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Discrete-Time Function

  1. Oct 5, 2015 #1
    Consider that:

    f(x(n)) = n*x(n)

    and that x(n) is 1 for n = 0,1,2,3 and 0 everywhere else.

    Thus, f(x(n)) will be for n = -5 to 5 like this:

    0 0 0 0 0 0 1 2 3 0 0

    Am I right?
  2. jcsd
  3. Oct 5, 2015 #2


    Staff: Mentor

    Looks fine to me. It might be simpler to write this:
    f(0) = 0
    f(1) = 1
    f(2) = 2
    f(3) = 3
    f(n) = 0 elsewhere
  4. Oct 5, 2015 #3
    Thanks for the answer. So, ok.

    Now, can I write that:

    f(x(n-m)) = (n-m)x(n-m) ?

    For example,

    f(x(n-15)) = (n-15)x(n-15)
  5. Oct 5, 2015 #4


    User Avatar
    Science Advisor

    That is improper notation.

    Probably what you have in mind is:

    Let x(n) = 1 for x in {0, 1, 2, 3} and 0 otherwise.
    Let f(n) = n*x(n).
  6. Oct 5, 2015 #5
    But I want to view this function as something that takes as input a function and returns another function.
    So, is like a discrete-time system. You apply a discrete-time waveform at its input and at its output you see another discrete-time waveform which is the result of the system acting on the input.

    Can't I do this?
  7. Oct 5, 2015 #6


    User Avatar
    Science Advisor

    Ahh, that makes more sense then. I do not want to weigh in on the proper notation for defining functions whose domain and co-domain are both sets of functions.
  8. Oct 5, 2015 #7
    So, the real reason why I made this post and my confusion.

    I can write x(n) = u(n) - u(n-4), where u(n) is the unit step function.

    f(x(n)) = f(u(n)-u(n-4)) = f(u(n)) - f(u(n-4)) = nu(n) - (n-4)u(n-4).

    And this function, plotted with wolfram alpha (x*unitstep(x)-(x-4)*unitstep(x-4)) gives the following result:

    0 0 0 0 0 0 1 2 3 4 4 4 4 ....

    So, this is my confusion. What am I doing wrong? That is a linear function and superposition principle applies.

    If, on the other hand, I am writing:

    f(x(n)) = n*x(n) = n*(u(n)-u(n-4))

    it gives the same result as in the first post.
  9. Oct 5, 2015 #8
    The problem contradicts itself, as follows:

    We have f(x(n))=n x(n) and x(n)=1 for n=0,1,2,3 and zero otherwise.

    Plugging in n=0, we have f(x(0))=0, so f(1)=0
    Plugging in n=1, we have f(x(1))=1.x(1), so f(1)=1

  10. Oct 5, 2015 #9
    Ok, I see the contradiction.

    So, I cannot write f(x(n)) = n*x(n).

    But I can write y(n) = n*x(n). So, the system takes as input some discrete-time waveform x(n) and produces another discrete-time waveform y(n).

    But, can you explain to me why I cannot write f(x(n)) = y(n) = n*x(n) ?

    If someone could shed light on this, I would be very happy. I'm thinking about this for days now.
  11. Oct 5, 2015 #10


    User Avatar
    Science Advisor

    That was where I was coming from in post #4. However, since the formal parameter "x(n)" on the left hand side is being treated as a function and since the formula on the right hand side is being treated as a function definition for the resulting function, the notation is not unreasonable and not contradictory.

    The intent is that it be read as:

    [ Let f be a function from the set of one-parameter functions to the set of one-parameter functions such that ] f(x(n)) = [the function y defined by y(n) =] n * x(n)

    We could then meaningfully ask about f(x)(n): the function y obtained by applying f to x, applied to argument n. This would produce an integer. e.g. f(x)(3) = 3.
    Or we could ask about f(x(n)), treating n as a dummy variable. This result would be a function and could be presented as a list of values as was done in the original post.
  12. Oct 5, 2015 #11
    What about my confusion on post #7?
  13. Oct 5, 2015 #12


    User Avatar
    Science Advisor

    The relevant definition being...
    I am in deep water here. Fighting to interpret the notation and understand your difficulty both. So bear with me while I try to parse this thing out.

    f(x(n)) = f( u(n) - u(n-4) )​

    So we have this operator f. It takes in a function x and spits out a function y. This first part of your assertion looks solid. It is mere definition.

    f( u(n) - u(n-4) ) = f(u(n)) - f(u(n-4))​

    This part looks dodgy. It seems to assume that f is linear. But let's skip past that.

    f(u(n)) - f(u(n-4)) = nu(n) - (n-4)u(n-4)​

    This part looks wrong. Try evaluating f(u(n-4)). You should not get (n-4)u(n-4)
  14. Oct 5, 2015 #13
    Here 's another illustration of the fact that you can't use the notation f(x(n)) = n x(n) to map the function x(n) to y(n):

    Evaluate f(1). The problem is that you can't tell whether n is 0,1,2 or 3. Each of these gives a different result.
  15. Oct 5, 2015 #14


    User Avatar
    Science Advisor

    If we interpret "1" as the constant function which takes all inputs to 1 and take f() as defined in the original post then f(1) is function g(x) = x * 1(x) = x. That is f(1) is the identity mapping.

    f(1)(1) = 1. f(1)(2) = 2, f(1)(n) = n
  16. Oct 5, 2015 #15
    But surely:
    if y(n) = n*x(n) then y(n-4) = (n-4)*x(n-4)

    I mean, view the function as a black box. If I input x(n), then I will get n*x(n). If I input instead at a later time, so I input x(n-4), then I should get (n-4)x(n-4).
    So, the moment of time where I input the function should not matter.

    You can view the waveforms on wolfram alpha.
    If you write unitstep(x) then you will see a unit step function. And to this it corrresponds x*unitstep(x).
    If I write unitstep(x-4), then this function starts at x=4. but is the same as unitstep(x). And to this it corresponds (x-4)*unitstep(x-4) which has the same form as x*unitstep(x), only delayed in time.

    But x*unitstep(x-4) has a very different form.
  17. Oct 6, 2015 #16


    User Avatar
    Science Advisor

    f, as you have claimed to define it is a function that transforms one function into a different function.
    y as you have defined it above is a function that transforms values into different values.

    Let's evaluate f(u(n-4)).

    u() is the unit step function. u(x) = 1 for x >= 0 and u(x) = 0 for x < 0.
    u(n-4) is the unit step function shifted right by 4. so u(n-4)(x) = 1 for x >= 4 and u(n-4)(x) = 1 for x < 4.

    Note that because f is a function that takes functions as input we must interpret its argument as a function and not as an integer value. That is why I have chosen to use the above notation -- to stress that "u(n-4)" is a function.

    f(u(n-4)) transforms this right-shifted step function by multiplying each of its computed results by n.

    f(u(n-4))(1) = 1*u(n-4)(1) = 1*u(1-4) = 0
    f(u(n-4))(2) = 2*u(n-4)(2) = 2*u(2-4) = 0
    f(u(n-4))(3) = 3*u(n-4)(3) = 3*u(3-4) = 0
    f(u(n-4))(4) = 4*u(n-4)(4) = 4*u(4-4) = 4
    f(u(n-4))(n) = n*u(n-4)(n) = n*u(n-4) = [n for n >= 4 and 0 for n < 4]
  18. Oct 7, 2015 #17
    Ok, I agree. I asked other people and they all say is n*u(n-4).

    Now, lets take it a step further and talk about linear, time-invariant systems.

    Consider that the response of the system to u(n) is s(n) = (1-a^(n+1))*u(n).

    Basically, is the same as n*u(n). I just replaced n with the exponential (1-a^(n+1)), where a is given.

    So to u(n) it corresponds s(n).

    Now if I want to find the response to x(n) = u(n) - u(n-4), I apply the superposition principle and do the following thing:

    - I calculate the output of the system separately: so to u(n) it corresponds s(n), and to u(n-4) it corresponds s(n-4)
    - I add the outputs to obtain y(n) = s(n)-s(n-4) = (1-a^(n+1))*u(n) - (1-a^(n-4+1))*u(n-4).

    So, observe that to u(n-4) it corresponds (1-a^(n-4+1))*u(n-4) and not (1-a^(n+1))*u(n-4).

    This is what happens in an LTI system. I can't say that to u(n-4) it corresponds (1-a^(n+1))*u(n-4) because if I take not 4, but 100, then at n = 100, when the step down happens, the exponential would have died and I don't want this. I don't want this because when the step goes down, I want it to go down exponential and not suddenly.

    So, what happens? Aren't linear, time-invariant systems described by functions but by other mathematical objects?
  19. Oct 7, 2015 #18
    I figured it out. y(n) = nx(n) is linear but not time-invariant. That is why it does not work what I was trying to do.

    For example, the RC circuit is LTI but the relationship between the input and output is not time-invariant.

    Thanks for your time.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook