0
\$\begingroup\$

I have the next signal

$$x_1[n]= 1 \ |n|\leq N_1; \ 0 \ otherwise$$.

Now I am given some points of sampling of the frequency of the fourier transform of the above signal. \$\omega_0 =\frac{2\pi}{5}\$, and \$\omega=k\omega_0\$ for \$k=-2,-1,0,1,2\$.

Now I am defining a periodic signal \$x_2[n]\$, which is given by:

$$x_2[n]=\sum_{k=-2}^{2} a_k e^{jk 2\pi n /5}$$

Where \$a_k\$ is given by the synthesis formula:

$$a_k=\frac{1}{5} \sum_{-2}^{2} x_1[n] \exp(-jk\frac{2\pi}{5}n)$$

I want to plot \$x_2[n]\$ in the \$n\$ space, but I don't want to calculate the \$a_k\$'s by hand, is there a way to do this by matlab, I mean without writing the full expression in paper and then typing it in matlab?

Is there such functionality?

Thanks in advance.

\$\endgroup\$
6
  • \$\begingroup\$ You probably did more work figuring out how to write this in MathJax than it would have taken to do it in Matlab. \$\endgroup\$
    – The Photon
    Commented Nov 28, 2012 at 5:24
  • \$\begingroup\$ Also, what's the value of N1? If it's not 1, then it's pretty pointless to have defined x1 at all, isn't it? \$\endgroup\$
    – The Photon
    Commented Nov 28, 2012 at 5:25
  • 1
    \$\begingroup\$ N1 is taken to be 1,2,3. And if you don't want to help then don't, I don't like the cynical tone of your comments. \$\endgroup\$ Commented Nov 28, 2012 at 6:51
  • \$\begingroup\$ It should be managable to do this in matlab, I recommend defining a function for calculating a, then you can just call this in the calculation of x. Please give it a shot and inform us where you get stuck. \$\endgroup\$ Commented Nov 28, 2012 at 12:29
  • \$\begingroup\$ @Mathematical, I'm trying to point out some inconsistencies in your question. For example, the result will be exactly the same for N1 = 2 and N1 = 3, therefore you don't have to do separate calculations for those two cases. That's already saved you 1/3 of the work you were thinking of doing. \$\endgroup\$
    – The Photon
    Commented Nov 28, 2012 at 17:23

1 Answer 1

1
\$\begingroup\$

What you have appears to be a Fourier series pair, over a very small number of samples.

Probably, by looking at the definition of the Fourier series (which may be different depending on the conventions you choose), and maybe a table of results in a mathematical handbook, you can solve this by inspection.

I'll call \$x_2[n]\$ the "time domain" signal and a[k] the "frequency domain" signal.

For example, when \$N_1 \ge 2\$ then you have a pure complex exponential in the frequency domain. Therefore you know you'll have a delta-function in the time domain.

If you considered the case \$N_1 = 0\$, you'd have a delta function in the frequency domain and you'd get a pure complex exponential in the time domain.

The case \$N_1=1\$ is slightly more complicated -- that gives a complex exponential windowed by a boxcar in the frequency domain. So you know you have a sinc() (possibly offset in time) in the time domain.

But your concern about the effort involved in "writing the full expression in paper" indicates you already know how to solve the problem and you are hoping there is a shortcut or easier solution. To me, working out these Fourier relationships on paper (carefully enough to be sure of the answer) would probably be more effort than just doing the calculation in Matlab.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.