I want to transform the continuous signal $$u(t)=u_0+\hat{u}\cdot \cos(2\pi \frac{t}{T_0})$$ to a discrete signal. The discrete signal should contain $N$ values and exactly $m$ periods (starting with $T_0$). Furthermore is given a (yet) undefined sampling period as $T_s$. How long must I sample this function? How can I mathematically transform it into a discrete signal?

I checked other questions regarding this topic and found out that when sampling I’m observing the function each time at the n-th period meaning I should get $$x(t)\rightarrow x(n\cdot(mT_0))$$ Is this correct?

Thanks in advance!


1 Answer 1


No, the expression $$x(t)\rightarrow x(n\cdot(mT_0))$$

is an incorrect representation of sampling.

Under certain conditions, a continuous-time signal can be completely represented by and recoverable from knowledge of its values, or samples, at points equally spaced in time (uniform sampling). This can be characterized by the following expression: $$x(t)\xrightarrow[C/D]{t=nT_s} x(nT_s)$$ where $T_s$ is your sampling period.

Here is an example to help you visualize this process:

Consider the a particular case of your function as $x(t) = 2+\cos(\pi t)$ (blue in the figure below) where $T_0$ is $2$, $\mu_0$ is $2$ and $\hat{\mu} = 1$.

Now if we replace $t\rightarrow nT_s$ and choose $T_s$ to be $1/2$ we will get the discrete function $x[n] =2+\cos(\frac{\pi}{2} n)$, in red. Sampled Cos

As you can see the samples are found at integer multiples of your sampling period. Here we sampled 5 periods of this cosine and that generated 20 samples (21st sample in the plot is extra). The original cosine in $x(t)$ had a period of $2$ seconds and we sampled it at every $0.5$ seconds.Here, $N=20$ and $m=5$ the answer to your question if the continuous function was as I gave in my example. To generate more such examples you can check this example out in desmos.

Sidenote: If you want to discretize your CT function in such a way that you could also recover it later then you should pay attention to your choice of $T_s$. To learn more about that issue study the Shannon-Kotelnikov sampling theorem.

  • 1
    $\begingroup$ Thanks for the great explanation! I thought that if I had$N$ values and $m$ Periods that i should choose a measurement period of $T_{meas}=N\cdot T_s$ where $T_s$ is my sampling period (because if i dont than im not targeting all present values). That way I should cover all desired values (correct me if I'm wrong). Futhermore i think that if I'm measuring $m$-times then i should use a measurement period of $T_{mess}=m\cdot T_0$ (correct me if I'm wrong). $\endgroup$
    – Tom
    Jul 30 at 15:49
  • 1
    $\begingroup$ The first statement is correct. In the above example if you wanted $N=5$ as shown then your measurement period/window will be $20 \cdot 1/2 =10$. And if you wanted $m=5$ then your measurement period/window would be $5 \cdot 2 =10$. However, if you wanted to not sample the last period fully then you could choose the minimum of the two (which would come from $N$). For e.g. choose $N=18$ gives you a measurement period of then your measurement period is $9$. $\endgroup$ Jul 30 at 15:57
  • 1
    $\begingroup$ Your second statement is incorrect because it does not consider what your $T_s$ will be since your $T_s$ will influence the numbers of $N$'s for a given $m$. In the example above $T=2 \neq 20/5$. However, $\frac{T}{T_s} = \frac{2}{1/2} =4 =20/5$. $\endgroup$ Jul 30 at 16:00
  • 1
    $\begingroup$ This is incorrect! The transformation from $C/D$ involves replacing $t$ with $nT_s$. However, your "discrete" function $u(n,m)$ has both $t$ and $n$ in it. Now as I understand it you have a cosine and you want to sample it for a fixed number of periods. If that is the case then your value for $m$ is already known. If on top of that you also fix the value for $N$ then you also have your value for $T_s$. How? Consider $z(t) = \cos(6\pi t)$. Now you know that its period is $T = 1/3$. Now let's say you want to sample it for $m=10$ periods which gives us $T_{meas} = \frac 13 10 = 10/3$. $\endgroup$ Jul 30 at 16:30
  • 1
    $\begingroup$ Then if you also fix $N$ to be let's say 40 samples then you have $T_s = T_{meas}/N = 10/120$ . Replace $t$ with $nT_s$ and you have your discrete sequence, $z[n] = \cos(\frac{\pi}{2} n)$. And this gives us $\frac{T}{T_s} = \frac{1/3}{1/12} = 4 = \frac Nm$. (I made a typo in my very first comment. It should be $N=20$ instead of $N=5$ in the first line of my first comment). $\endgroup$ Jul 30 at 16:41

Your Answer

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

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