# Spectrum of OFDM with raised cosine window

I'm having trouble implementing OFDM with a raised cosine (RC) window in Matlab. I know how to generate an OFDM signal and how to show its spectrum, I just don't know how to generate the window extensions. Each OFDM symbol is extended by $TW$ samples at both ends to smooth the transitions between successive symbols, this is done mainly to improve the out of band spectrum and reduce the interference to adjacent channels. I'm hoping someone here knows how to do this.

• @ Deve ..Last W samples of an OFDM symbol should be added to the first W samples of the successive symbol. Does the term "added" mean addition or append. – user12150 Dec 22 '14 at 17:52
• @user2014 It means mathematical addition, see the expression for $u(t)$. – Deve Jan 6 '15 at 14:27

This spectral shaping technique is applied in time domain, after adding the guard interval (GI). But I find it easier to add GI and the cyclic extension for windowing in one step. Let $x(n)$ be an $N$ subcarriers OFDM symbol without guard interval. Then $W + G$ samples are copied to the beginning accounting for guard interval and windowing samples. Additionaly, $W$ samples are copied to the end, also for windowing: $$y(n) = \begin{cases} x(n+N) & \text{for} & -G-W \leq n \leq -1 \\ x(n) & \text{for} & 0 \leq n \leq N -1 \\ x(n-N) & \text{for} & N \leq n \leq N + W -1 \end{cases}$$ In the next step, the raised cosine function is applied to the first and last $W$ samples of $y(n)$, respectively. The windowing function $w(n)$ is given by: $$w(n)= \begin{cases} \cos^2\left( \frac{n+G+1}{W-1} \frac{\pi}{2}\right) & \text{for} & -G-W \leq n \leq -G-1 \\ 1 & \text{for} & -G \leq n \leq N - 1 \\ \cos^2\left( \frac{n-N}{W-1} \frac{\pi}{2}\right) & \text{for} & N \leq n \leq N+W-1 \\ 0 & \text{otherwise} \end{cases}$$ $w(n)$ is similar but not equal to the transfer function of a raised cosine filter often used as impulse shaper in single carrier transmission systems. The two differences are: (1) the raised cosine function is applied in time domain for OFDM systems and in frequency domain for single carrier systems and (2) the "flat top" is usually much longer for OFDM systems, whereas its length is in a fixed relation with the flanks' length, given by the roll-off factor, for single carrier systems.

Finally, the OFDM symbol including GI and spectral shaping is calculated by $$z(n) = w(n)y(n)$$

When transmitting several OFDM symbols $z_i(n)$, two consecutive symbols overlap at $W$ samples. The discrete transmit signal $u(n)$ is therefore given by $$u(n)=\sum_{i=-\infty}^\infty z_i(n-i(N+G+W))$$

The implementation in Matlab should now be straightforward by substituting $n$ with $n' = n + G+ W+ 1$ in the above equations. Leave a comment if not.

• Thank you for the answer. Lets say the windowing extension is $16$ samples, the CP length is $16$ samples, so I will copy the first $16$ samples and append them to the end of the OFDM symbol, and copy the last $32$ samples (last samples before the previous step) and add them to the start of the symbol. Then I'm going to apply the left and right window to the first and last 16 samples respectively. I'm going to do this for every OFDM symbol. With this each symbol is extended by $32$ samples, however each symbol should be extended by only 16 samples. How are symbols going to overlap?. – user4259 Apr 1 '13 at 15:10
• The last $W$ samples of an OFDM symbol should be added to the first $W$ samples of the successive symbol. This means that each symbol effectively has an overhead of $W+G$ samples. If the overhead needs not to exceed $G$ you could use a cyclic pre- and postfix of $G/2$, respectively and apply the window function to this. However, this will introduce inter-symbol interference in a dispersive channel. – Deve Apr 1 '13 at 15:41
• I understand that each symbol should effectively be extended by $W+G$ samples. However, we already added $W+G$ and $W$ symbols to the start and end of the each symbol. So, even after adding the last $W$ samples of the current symbol to the first $W$ samples of the next symbol, that leaves each symbol extended by $G+2W$ samples. I guess my question is implementation wise, or may be I missing something. – user4259 Apr 1 '13 at 16:03
• @user4259 If two consecutive symbols overlap by $W$ symbols at beginning and end, each OFDM symbol has an additional overhead of just $W$ samples. You have to take into account either the last or the first $W$ samples as overhead, but not both, because the overhead can only "belong" to one symbol not to to two at once. – Deve Apr 1 '13 at 16:07
• OK, that explains what I was missing. Thank you. – user4259 Apr 1 '13 at 16:54