2
$\begingroup$

I have $x[n]$ which is discrete unit step function where for $n < 0$, $x[n] = 0$. For $n \geq 0 $, $x[n] = 1$. Now, if I have $x[n-4]$, the $x[n]$ is shifted to the right by $4$. Now, if I have $x[-n]$, then $x[n]$ is flipped. So then, when I have $x[4-n]$, then shouldn't it be the following: $n \leq -4, x[n] = 1\text{; } n > -4, x[n] = 0$?

But the graph shows the following: enter image description here

What am I missing? Why is what I thought wrong?

$\endgroup$
4
  • $\begingroup$ Check the value of $x[4-n]$ at different values of $n$. For example at $n=2$ your claim is $y=x[4-n]=0$, but $x[4-n]=x[4-2]=x[2]=1$; so redo the calculation. (Please do not mix the $x$ with $n$, it's confusing to read!) $\endgroup$
    – rookie
    Feb 15, 2017 at 7:52
  • 1
    $\begingroup$ @stud_iisc sorry for the notation abuse. I have editted the OP. Please see comment I have left in the accepted answer. $\endgroup$
    – Jonathan
    Feb 15, 2017 at 7:58
  • $\begingroup$ I am completely flabbergasted by the notation. You have a function called $x$ (and with its argument written in square brackets), certainly not a great choice of name. The values of $x$ are called $y$ in the graph, while the argument is called $x$ there, but in actual usage the argument is $n$ (a real number) or some expression involving $n$. And the actual question is not about $x$, but about other anonymous functions that might be written like $n\mapsto x[4-n]$. No wonder you get confused. $\endgroup$ Feb 15, 2017 at 10:23
  • $\begingroup$ The discrepancy between the graph and my notation is because I used wolfram alpha and it automatically graphs using x and y. In reference to your comment by variable naming, the standard to refer to discrete functions is to use x[n]. And I don't think I introduced any anonymous function here. So I'm not sure what you're referring to. But thanks for your input. @MarcvanLeeuwen $\endgroup$
    – Jonathan
    Feb 15, 2017 at 22:46

2 Answers 2

1
$\begingroup$

For the unit step function $x[n] = 1$ if $n\ge0$ and $x[n] = 0$ if $n<0$.

Now, $x[4-n]=1$ if $4-n\ge 0$. So, $x[4-n]=1$ if $4 \ge n$. Thus for $n \le 4$, the function has value $1$ and $0$ otherwise, as shown in the graph.

$\endgroup$
3
  • $\begingroup$ Hmm, doing it mathematically makes sense. But I'm not sure where I have erred in my logic at an intuitive level. $\endgroup$
    – Jonathan
    Feb 15, 2017 at 7:56
  • $\begingroup$ You have erred when flipping $x[n]$ . $x[4-n]$ will be flipped form of $x[n-4] $ which is $1$ for $n \ge 4$ so your function will be $1$ for $n \le 4$ . $\endgroup$ Feb 15, 2017 at 7:58
  • $\begingroup$ @Christian you must need to go through the rule of shifting and scaling order, which I have explained in the answer post. $\endgroup$
    – rookie
    Feb 15, 2017 at 8:12
1
$\begingroup$

Another way to look at it: The rule follows the order of first shifting then scaling and then comes the reversal. Read http://www.princeton.edu/~cuff/ele301/files/lecture1_2.pdf for more details.

So in $x[4-n]$, first shift by $4$; which yields $y=0$ for $n\leq -4$ and $y=1$ otherwise.

Now reverse $y$ to get $x[4-n]$; which yields $x[4-n]=0$ for $n \geq 4$ and $x[4-n]=1$ otherwise. (as shown in the figure by OP in the question details.)

$\endgroup$
2
  • $\begingroup$ This is actually really helpful. But small question. When we first do a shift, aren't we shifting x[n] left by 4? So then, for all values of n greater than -4, it should be right? But I believe you have written it the other way around? $\endgroup$
    – Jonathan
    Feb 15, 2017 at 22:26
  • $\begingroup$ Thanks @Christian, indeed it was a typo! $\endgroup$
    – rookie
    Feb 16, 2017 at 3:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .