# change function from continuous to discrete

I have function that I want to sample with sampleing rate 20 Msamples/sec.

The funciton is the one below

$w_T(t)= \left\{ \begin{array}{ll} \sin^2(\frac{\pi}{2}(0.5+\frac{t}{T_{TR}})) & \mbox{if$-T_{TR}/2 < t<T_{RT}/2$};\\ 1 & \mbox{if$T_{TR}/2 < t<T-T_{TR}/2$}\\ \sin^2(\frac{\pi}{2}(0.5-\frac{t-T}{T_{TR}})) & \mbox{if$T-T_{TR}/2 < t<T+T_{TR}/2$};\\ \end{array} \right.$

I saw the solution is

$w_T(n)=\left\{ \begin{array}{ll} 1 & \mbox{if$1<n<79$};\\ 0.5 & \mbox{if$0,80$}.\end{array} \right.$

I tried to see why it so so I put $t=n T_s= n \frac{1}{20\times10^{-6}}$. It is also given that $T_{TR}= 100 ns$ and $T=4 \mu sec$. But i fail to reach the discrete funciton.

Is there any way to reach solution?

• You also need to know $T$, which is used in the definition of $w_T(t)$. – Matt L. Jun 3 '15 at 21:03
• Sorry I will update I forgot to mention that – Henry Jun 3 '15 at 21:04
• Your question has the problem that its sampling time (20 Mhz => 50ns ) coincides with the piecewise function definition intervals which are not defined very carefully. Some of the sampling instants are exactly matching with those interval boundaries which are not included in any of the pieces? Also the first and last limits are not included too. Apart form this ambiguity, answer seems to be correct except the fact that the final piece seems to include a sample of 0 before the last 0.5 in my simple simulation. – Fat32 Jun 3 '15 at 21:53
• I think I had typo, can you please give simple guide how to find the function @Fat32 – Henry Jun 4 '15 at 1:16

if you take sampling frequency as 20Msamples/sec then sampling time Ts is $$T_s=\frac{1}{f_s}\\T_s=\frac{1}{20\times10^6}\\T_s=50ns$$since the solution is till n=79 we can see that t=79*50=3950
From the continues time function this Trt/2=50ns and T-Trt/2=3950ns hence we get 1 n=1 to 79 when n=0 we get the first case which is equal to 0.5 similarly of n=80.This can be see as$$w_T(nT_s)= \begin{cases} \sin^2(\frac{\pi}{2}(0.5 +\frac{n50ns}{100ns})),& \text{if } -50\times10^{-6}<n50\times10^{-6}<50\times10^{-6}\\ 1, & \text{if } 50\times10^{-6}\leq n50\times10^{-6}\leq 3950\times 10^{-6}\\ \sin^2(\frac{\pi}{2}(0.5 -\frac{n50ns-4000ns}{100ns})),&\text{if } other case \end{cases}$$ which comes down to
$$w(n)= \begin{cases} \sin^2(\frac{\pi}{2}(0.5 +\frac{n}{2})),& \text{if } -1<n<1\\ 1, & \text{if } 1\leq n\leq79\\ \sin^2(\frac{\pi}{2}(0.5 -\frac{n-79}{2})),&\text{if } 79<n<81 & \text{otherwise} \end{cases}$$ In the above equation we can remove the $$-1<n<1$$as n=0 when n=0 w(0)=0.5 for n=1to78 w(n)=1.When n=80 the third one become zero.Hence you get the finalized expression.I hope this answers your question