Calculating the Fourier Transform of a Digital Signal

andrey21
Messages
475
Reaction score
0
Find the Fourier transform of the following aperodic digital signal



x[n] = 3

for -2<n<2


3. Not to surer where to start on this one any help would be great thanks
 
Physics news on Phys.org
I presume the function is zero for |n| &gt; 2, correct?

Then by definition, the Fourier transform is

X(\omega) = \sum_{n = -2}^{2} 3 e^{-i \omega n}

Let us know where you got stuck.
 
Ok so working form that I obtained:

3{ d[n-2] + d[n-1] + d[n] + d[n+1] + d[n+2] }e^(-jnw)

= 3 {e^(-2jw) + e^(-jw) + 1 + e^(jw) + e^(+2jw)

= 3 (1 + 2COSw + 2COS2w)

Is this correct?
 
Jamiey1988 said:
Ok so working form that I obtained:

3{ d[n-2] + d[n-1] + d[n] + d[n+1] + d[n+2] }e^(-jnw)

= 3 {e^(-2jw) + e^(-jw) + 1 + e^(jw) + e^(+2jw)

= 3 (1 + 2COSw + 2COS2w)

Is this correct?

Looks good to me.
 
Thanks jbunnii. I do have another question it is exactly the same as the previous one except. x[n] = -2n. Its a little bit more complicated how would I go about solving that.
 
By the way, there is another, equivalent way to write the solution. To see it, note that

e^{-2i\omega} + e^{-i\omega} +1 + e^{i\omega} + e^{2i\omega} = e^{-2i\omega}(1 + e^{i\omega} + e^{2i\omega} +1 + e^{3i\omega} + e^{4i\omega})

which equals

e^{-2i\omega}\frac{1 - e^{5i\omega}}{1 - e^{i\omega}}

You can rearrange this to get:

e^{-2i\omega} \left(\frac{e^{2.5i\omega}}{e^{0.5i\omega}}\right)\left(\frac{e^{-2.5i\omega}-e^{2.5i\omega}}{e^{-0.5i\omega}-e^{0.5i\omega}}\right)

which simplifies to

\frac{\sin(2.5\omega)}{\sin(0.5\omega)}
 
Last edited:
Jamiey1988 said:
Thanks jbunnii. I do have another question it is exactly the same as the previous one except. x[n] = -2n. Its a little bit more complicated how would I go about solving that.

Is it defined this way for all n, or is it zero outside a certain interval?
 
It says for -2<n<2 like in the previous question so I am guessing all other values are 0.
 
Jamiey1988 said:
It says for -2<n<2 like in the previous question so I am guessing all other values are 0.

So it's

X(\omega) = \sum_{n = -2}^{2} (-2n) e^{-i \omega n}

Try writing it out term by term and using trig identities like you did with the previous question.
 
  • #10
Oh ok I will try that approach and see what answer i come up with. Just a quick question where I got my answer 3(1+2cosw+2cos2w) it was taken from an example given to me so I am nt sure how to get from:
3 {e^(-2jw) + e^(-jw) + 1 + e^(jw) + e^(+2jw)
to
3(1+2cosw+2cos2w)
 
  • #11
Never mind i see now it comes from trig idenitity

cos w = 1/2 ( e^(jw) + e^(-jw)
 
  • #12
Jamiey1988 said:
Never mind i see now it comes from trig idenitity

cos w = 1/2 ( e^(jw) + e^(-jw)

Right.
 
  • #13
Rite for the second question i posed which was to find fouier transform of x[n] = -2n i got the following:

= -4e^(-2jw) -2e^(-jw) + 0 + 2e^(jw) + 4e^(2jw)

Is this correct, i calculated each term individually.
 
  • #14
Yes it's correct, but it can be simplified.

What is

-e^{-2i\omega} + e^{2i\omega} ?
 
  • #15
I agree with all the posts here except this one:
jbunniii said:
By the way, there is another, equivalent way to write the solution. To see it, note that

e^{-2i\omega} + e^{-i\omega} +1 + e^{i\omega} + e^{2i\omega} = e^{-2i\omega}(1 + e^{i\omega} + e^{2i\omega} +1 + e^{3i\omega} + e^{4i\omega})
You have an extra "1" term on the right.
jbunniii said:
which equals

e^{-2i\omega}\frac{1 - e^{5i\omega}}{1 - e^{i\omega}}
I don't see this, either.
I'd go with the expression that Jamiey1988 found.
 
  • #16
marcusl said:
I agree with all the posts here except this one:

You have an extra "1" term on the right.

You're right. Poor editing on my part.

I don't see this, either.
I'd go with the expression that Jamiey1988 found.

If z \neq 1 is a complex number, then

\sum_{n=0}^{N-1}z^n = \frac{1 - z^N}{1 - z}

To verify this, write out the sum term by term, and multiply both sides by 1 - z. The terms telescope and you are left with 1 - z^N.

The final answer,

\frac{\sin(2.5\omega)}{\sin(0.5\omega)},

is interesting because it is analogous to the \sin(\omega)/\omega (or "sinc" function) that one obtains for the Fourier transform of a rectangular function of a continuous variable.

This form is also very useful in signal processing, as it allows one to easily answer the question "how much attenuation results if I filter a sinusoidal input signal with frequency \omega using a moving average filter (of length 5 in this case)?"

Jamiey1988's answer is mathematically correct, but whether it is the best form depends on the context. If it is homework for a signal processing course (as suggested by the "digital signal" terminology in the original question), the instructor might implicitly expect the "sin/sin" form.
 
Last edited:
  • #17
Oh sure! Summation to the Dirichlet kernel. Sorry I didn't recognize it.
 
  • #18
jbunni replying to ur post:

what is:

-e^(-2iw) +e^(2iw)

given the trig identity

sin w = 1/j^(2) . (e^jw - e^-jw)

I obtained

4sin2W + 2sinW
= 2(2sinw + sinw)

is this correct?/
 
  • #19
Jamiey1988 said:
jbunni replying to ur post:

what is:

-e^(-2iw) +e^(2iw)

given the trig identity

sin w = 1/j^(2) . (e^jw - e^-jw)

I obtained

4sin2W + 2sinW
= 2(2sinw + sinw)

is this correct?/

That's not quite correct.

The trig identity is

\sin x = \frac{1}{2i}(e^{ix} - e^{-ix})

Now multiply both sides by 2i to get the formula you need. In particular, notice that your answer will be imaginary, not real.
 
Last edited:
  • #20
Ah yes so the trig identity I would obtain is:

2i sin x = e^(ix) - e^-(ix)

from this would the answer be:

8i sin2x + 4i sinx

4i (sin2x+sinx)

correct?
 
  • #21
Jamiey1988 said:
Ah yes so the trig identity I would obtain is:

2i sin x = e^(ix) - e^-(ix)

from this would the answer be:

8i sin2x + 4i sinx

4i (sin2x+sinx)

correct?

Looks good to me.
 
  • #22
Great now all the final part of the question states is to sketch the amplitude and characterisitics of these spectra pver the range:

-3\pi < \Omega < 3\pi

Can I just do this using Excel for example, and use the Fourier transform an various points to establish a sketch?
 
  • #23
Jamiey1988 said:
Great now all the final part of the question states is to sketch the amplitude and characterisitics of these spectra pver the range:

-3\pi < \Omega < 3\pi

Can I just do this using Excel for example, and use the Fourier transform an various points to establish a sketch?

Certainly it's possible to do this with Excel. Whether you should do that or sketch it manually is up to you (and your instructor).

Supposing you wanted to do it manually, the first step would be to try to come up with as simple an expression as possible for the magnitude.

For the previous problem it is this:

\left|\frac{\sin(2.5\omega)}{\sin(0.5\omega)}\right|

which is a function you should try to become familiar with if you are studying signal processing. Sketching it manually (at least once) is a good idea.
 
  • #24
Thanks Jbunnii I have sketched the first one no problem using Excel the second is causing me more problems as it contains imaginary numbers. How would I go about sketching this??
 
  • #25
Jamiey1988 said:
Thanks Jbunnii I have sketched the first one no problem using Excel the second is causing me more problems as it contains imaginary numbers. How would I go about sketching this??

Can you write down an expression for the magnitude of

4i (\sin 2x + \sin x)?
 
  • #26
Ah i see so for example magnitude of the first one would be:

3(1+2cosw+2cos2w)

= 3 . SQRT((1+2cosw+2cos2w)^2)

and sketch using the above.
 
  • #27
Jamiey1988 said:
Ah i see so for example magnitude of the first one would be:

3(1+2cosw+2cos2w)

= 3 . SQRT((1+2cosw+2cos2w)^2)

and sketch using the above.

Right, or simply

3\cdot|1 + 2\cos \omega + 2 \cos 2\omega |

i.e. no need to actually perform the square and square root operations. Absolute value is much simpler - just get rid of any negative sign that pops up.
 
  • #28
Ok so from what u wrote above is it 3 mulitplied by the magnitude of (1+2cosw+2cos2w)?
 
  • #29
Jamiey1988 said:
Ok so from what u wrote above is it 3 mulitplied by the magnitude of (1+2cosw+2cos2w)?

Yes, that's the magnitude of the Fourier transform.

Are you also asked for the phase? Do you know what that would be in this case?
 
  • #30
Well the question just states find the Fourier transform which I have then plot amplitude and phase characteristics so I think i mite. I am nt too sure what it would be??
 
  • #31
OK, the phase of a real-valued function is easy: it's 0 wherever the function is positive, and it's \pi wherever the function is negative. The phase is undefined at any points where the function is 0. Or, alternatively, you can define it to be whatever you like at such points.

Now consider the second problem: in that case, the Fourier transform turned out to be imaginary. What's the phase in that case?
 
  • #32
Rite are the plot amplitude and phase characterisitics meant to be on different charts:

For example:
<br /> 3\cdot|1 + 2\cos \omega + 2 \cos 2\omega |<br />
Would give the amplitude.

What u sed above gives the phase characteristics?

Im still a little confused:confused:
 
  • #33
Jamiey1988 said:
Rite are the plot amplitude and phase characterisitics meant to be on different charts:

For example:
<br /> 3\cdot|1 + 2\cos \omega + 2 \cos 2\omega |<br />
Would give the amplitude.

What u sed above gives the phase characteristics?

Im still a little confused:confused:

Well, one way to write a formula for the phase would be to use the "sgn" function:

\mbox{sgn}(x) = \begin{cases}<br /> 1, &amp; \mbox{if }x &gt; 0 \\<br /> 0, &amp; \mbox{if }x = 0\\<br /> -1, &amp; \mbox{if }x &lt; 0<br /> \end{cases}
 
  • #34
By the way, it's probably easier to determine the phase if you use the alternative form which I derived in post #6:

\frac{\sin(2.5 \omega)}{\sin(0.5\omega)}

In this form it's easier to see when the function is positive and when it is negative. It is positive when the numerator and denominator have the same sign, and it is negative when they have opposite signs.

Notice that the period of the denominator is an integer multiple (5) of the period of the numerator. As \omega increases, the numerator runs through exactly five cycles of the sine function for every one cycle in the denominator.
 
  • #35
Ok so using th alternative form I can just sub in values for w from -3pi to pi and from resulting values i can see whether they are positive zero or negative.

And as u sed

positive = 0
negative = pi
zero = undefined
 
Last edited:
  • #36
Ive just noticed I may have made an error. For the Fourier transform mentioned in post 18.
I concluded that:

8i sin2x + 4i sinx

could be written as:

4i (sin2x+sinx)

However I have missed a 2 out from sin2x.

So should it be:

4i (2sin2x + sinx)

marcusl or jbunni does this look correct to u?
 
  • #37
Jamiey1988 said:
Ive just noticed I may have made an error. For the Fourier transform mentioned in post 18.
I concluded that:

8i sin2x + 4i sinx

could be written as:

4i (sin2x+sinx)

However I have missed a 2 out from sin2x.

So should it be:

4i (2sin2x + sinx)

marcusl or jbunni does this look correct to u?

It looks right to me. I hadn't noticed the earlier error you pointed out.
 
  • #38
Thanks Jbunnnii I only just noticed it myself. For the first Fourier transform i sketched the magnitude of the function and it oscillates between 9 and 6.708. From -3pi to 3pi. This seem correct to u??
 
Last edited:
  • #39
Also would the magnitude of:
4i (2sin2x + sinx)
be

SQRT-16 .((2sin2x)^2 + (sinx)^2)

which would give me imaginary numbers so cannot be plotted.
 
  • #40
Jamiey1988 said:
Also would the magnitude of:
4i (2sin2x + sinx)
be

SQRT-16 .((2sin2x)^2 + (sinx)^2)

which would give me imaginary numbers so cannot be plotted.

No, that's not right.

What is the magnitude of 4i? It's 4, not -4.
 
  • #41
Ah i see so the magnitude would be:

4.SQRT((2sin2x)^2 + (sinx)^2)
 
  • #42
Jamiey1988 said:
Ah i see so the magnitude would be:

4.SQRT((2sin2x)^2 + (sinx)^2)

No, you left out a term.

The magnitude is

4 \sqrt{(2 \sin 2x + \sin x)^2}

When you expand the square, you get three terms, not two.

Or, you can simply express it as

4 |2 \sin 2x + \sin x|

which is probably easier to work with if all you want to do is plot it.
 
  • #43
Ok I thought magnitude was fo example:

SQRT((a)^2 +(b)^2) not SQRT (a+b)^2

SO to plot magnitude i must expand the brackets to give me three terms. Could u expand the brackets I am little confused.
 
  • #44
Jamiey1988 said:
Ok I thought magnitude was fo example:

SQRT((a)^2 +(b)^2) not SQRT (a+b)^2

The first form is not true in general, but only if a and b are the lengths of two perpendicular vectors and you want the magnitude of the sum of the vectors. (Think Pythagorean theorem.) For example, if z was a complex number, with real component a and imaginary component b, then

|z| = \sqrt{|z|^2} = \sqrt{|a + bi|^2} = \sqrt{(a + bi)(a - bi)} = \sqrt{a^2 + abi - abi + b^2} = \sqrt{a^2 + b^2}

Notice that the middle two terms, abi and -abi, canceled each other. This happens precisely because a and bi are perpendicular to each other.

But you have a different situation. You have a real number,

2 \sin 2x + \sin x,

and you want its magnitude (absolute value).

In general, if r is a real number, then its absolute value is

|r| = \sqrt{|r|^2} = \sqrt{r^2}

So in your case

|2 \sin 2x + \sin x| = \sqrt{(2 \sin 2x + \sin x)^2}

Now expand the square:

(2 \sin 2x + \sin x)^2 = 4\sin^2 2x + 4 \sin 2x \sin x + \sin^2 x

The middle term is the one you are missing.
 
Last edited:
  • #45
Rite ok I understand now how to calculate magnitude. All I have to do now is sub values form -3pi t0 3pi in order to gain the plot required.

Should I adopt the same technique for:

<br /> <br /> 3\cdot|1 + 2\cos \omega + 2 \cos 2\omega |<br /> <br />
 
  • #46
Jamiey1988 said:
Rite ok I understand now how to calculate magnitude. All I have to do now is sub values form -3pi t0 3pi in order to gain the plot required.

Should I adopt the same technique for:

<br /> <br /> 3\cdot|1 + 2\cos \omega + 2 \cos 2\omega |<br /> <br />

Yes, although as I mentioned before, it might be easier if you use the equivalent form

3 \cdot \left| \frac{\sin(2.5 \omega)}{\sin(0.5 \omega)} \right|
 
  • #47
Ye I will adopt ur equvalent form to plot with. With the magnitude obtained for the second Fourier transform where u expanded the square. Would it be easier to rewrite:

sin^(2) x using the chain rule to obtain 2sin(x)cos(x)

Just as I am using Excel to plot the magnitudes. And would that give:

4sin^(2) 2x = 8sin2xcos2x
 
Back
Top