\documentclass[a4paper,french,11pt]{article}

\title{
Théorie du signal --- TD1
\\ \large Décomposition en Série de Fourier
}
\author{}
\date{Dernière compilation~: \today{} à \currenttime}

\usepackage{../../cours}
\usepackage{enumitem}
\usepackage{xfrac}
\usepackage{tikz}

\begin{document}

\maketitle

\section{I}

\subsection{Signal carré}

    Soit le signal carré $x(t)$, $T_0$-périodique tel que~:
    \begin{align*}
        x(t) =
        \left\{
        \begin{array}{ll}
            -1 \quad \forall\, t \in [-\frac{T_0}{2};0] \\
            1 \quad \forall\, t \in [0;\frac{T_0}{2}] \\
        \end{array}
        \right.
    \end{align*}

    \subsubsection{Tracer le signal $x(t)$}

        \begin{center}
        \begin{tikzpicture}

            \draw[help lines, dashed] (-7,-2) grid (7,2);
            \draw[-latex] (-7,0) -- (7,0) node[below]{$t$};
            \draw[-latex] (0,-2) -- (0,2) node[left]{$x(t)$};

            \foreach \i in {-6, -4, -2, 0, 2, 4, 6}{
                \draw[very thick, teal]
                    (\i-1,1) -- (\i-1,-1)
                    plot[domain=\i-1:\i]({\x}, {-1})
                    (\i,1) -- (\i,-1)
                    plot[domain=\i:\i+1]({\x}, {1})
                    ;
            }

        \end{tikzpicture}
        \end{center}

    \subsubsection{Calculer les coefficients de Fourier réels $a_0, a_n, b_n$ du signal $x(t)$}

        $x$ est impaire donc $a_0 = a_n = 0$.

        \begin{tabularx}{\linewidth}{XX}
            {
            \begin{equation*}
                \text{formule~:} \quad b_n = \frac{2}{T_0} \int_{(T_0)} x(t) \sin(n\omega_0 t) \dif t
            \end{equation*}
            \vspace{4cm}
            \begin{equation*}
                x(t) = \sum_{n=1}^{+\infty} \frac{2}{n\pi}(1 - (-1)^n) \sin(n\omega_0 t)
            \end{equation*}
            } &
            {
            \begin{align*}
                b_n &= \frac{4}{T_0} \int_0^{T_0/2} 1 \sin(n\omega_0 t) \dif t \\
                    &= \frac{4}{T_0} \left[\frac{-\cos(n\omega_0 t)}{n\omega_0}\right]_0^{T_0/2} \\
                    &= \frac{4}{T_0} \left(\frac{-\cos(n2\pi f_0 \frac{T_0}{2}) + 1}{n2\pi f_0}\right) \\
                    &= 2 \left(\frac{-\cos(n\pi) + 1}{n\pi}\right) \\
                    &= \frac{2}{n\pi} (-\cos(n\pi) + 1) \\
                    &= \frac{2}{n\pi} (-(-1)^n + 1) \\
                b_n &= \boxed{\frac{2}{n\pi} (1 -(-1)^n)}
            \end{align*}
            } \\
        \end{tabularx}


    \subsubsection{Tracer la DSP du signal $x(t)$}

        \begin{align*}
            |c_n|^2 = |-j\frac{1}{2}b_n|^2 = \frac{1}{4}b_n^2 = \frac{1}{4}(\frac{2}{n\pi})^2(1 - (-1)^n)^2
        \end{align*}
        \begin{align*}
            S_x(f) = \sum_{-\infty}^{+\infty} |c_n|^2 \implies
            \left\{
            \begin{array}{l}
                \text{si } n \text{ est pair, } b_n = 0 \implies |c_n|^2 = 0 \\
                \text{si } n \text{ est impair, } b_n = \frac{4}{n\pi} \implies |c_n|^2 = \frac{4}{(n\pi)^2} \\
            \end{array}
            \right.
        \end{align*}

\subsection{Signal en dent de scie}

    Soit le signal $x(t)$, $T_0$-périodique tel que~:
    \begin{align*}
        x(t) = A \times \frac{1}{T_0}t \quad \forall\, t \in [0;T_0] \\
    \end{align*}

    \subsubsection{Tracer le signal $x(t)$}

        \begin{center}
        \begin{tikzpicture}

            \draw[help lines, dashed] (-8,-2) grid (8,2);
            \draw[-latex] (-8,0) -- (8,0) node[below]{$t$};
            \draw[-latex] (0,-2) -- (0,2) node[left]{$x(t)$};

            \foreach \i in {-8, -6, -4, -2, 0, 2, 4, 6}{
                \draw[very thick, teal]
                    plot[domain=\i:\i+2]({\x}, {1.7*(\x-\i)/2})
                    (\i+2,0) -- (\i+2,1.7)
                    ;
            }

        \end{tikzpicture}
        \end{center}

\subsection{Signal porte}

    Soit le signal $x(t)$, de largeur $T>0$ tel que~:
    \begin{align*}
        x(t) = A\Pi_r(t) =
        \left\{
        \begin{array}{ll}
            A \quad \forall\, t \in [-\frac{T}{2};\frac{T}{2}] \\
            0 \text{ sinon} \\
        \end{array}
        \right.
    \end{align*}

    \subsubsection{Calculer $X(f)$, la TF de $x(t)$. Représenter la DSE de $x(t)$}
        \begin{equation*}
            X(f) = \int_{\mathbb{R}} x(t) e^{-j2\pi ft} \dif t
        \end{equation*}
        \begin{align*}
            X(f) &= \int_{-T/2}^{T/2} A e^{-j2\pi ft} \dif t \\
                 &= A \left[\frac{e^{-j2\pi ft}}{-j2\pi f}\right]_{-T/2}^{T/2} \\
                 &= A \left(\frac{-e^{-j\pi fT} - e^{j\pi fT}}{-j2\pi f}\right) \\
                 &= A \left(\frac{e^{j\pi fT} - e^{-j\pi fT}}{-j2\pi f}\right) \\
                 &= A \textcolor{red}{T} \frac{\sin(\pi fT)}{\pi f \textcolor{red}{T}} \\
            X(f) &= \boxed{AT \text{sinc}(fT)}
        \end{align*}

        \paragraph{DSE}

            \begin{align*}
                S_x(f) &= |X(f)|^2 \\
                       &= A^2T^2\text{sinc}^2(fT)
            \end{align*}

            \begin{align*}
                \text{Rappel~: }
                \left\{
                \begin{array}{l}
                    \text{sinc}(0) = 1 \\
                    \text{sinc}(fT) = \frac{\sin(\pi fT)}{\pi fT} \\
                \end{array}
                \right.
            \end{align*}

            \begin{center}
            \begin{tikzpicture}
                %TODO plot this
                \draw[help lines, dashed] (-7,-1) grid (7,5);
                \draw[-latex] (-7,0) -- (7,0) node[below]{$f$};
                \draw[-latex] (0,-1) -- (0,5) node[left]{$S_x(f)$};
                % T = 3
                \draw[very thick, teal, smooth]
                    plot[domain=-7:7]
                    (-7.0, 9.236424985855951e-66) --
                    (-6.9, 1.351508856906833e-07) --
                    (-6.8, 9.82042242286396e-07) --
                    (-6.7, 1.0419973375281967e-06) --
                    (-6.6, 1.6145054556795375e-07) --
                    (-6.5, 2.1247489470901966e-65) --
                    (-6.4, 1.825977253441778e-07) --
                    (-6.3, 1.3329185814786595e-06) --
                    (-6.2, 1.4210163081164671e-06) --
                    (-6.1, 2.2125643933133683e-07) --
                    (-6.0, 9.236424985855951e-66) --
                    (-5.9, 2.5281754659351027e-07) --
                    (-5.8, 1.8554696109297905e-06) --
                    (-5.7, 1.9891447935831516e-06) --
                    (-5.6, 3.1150365806319875e-07) --
                    (-5.5, 1.6166354311481645e-63) --
                    (-5.4, 3.602800545131002e-07) --
                    (-5.3, 2.661107026328134e-06) --
                    (-5.2, 2.8717884569168376e-06) --
                    (-5.1, 4.528293363652966e-07) --
                    (-5.0, 9.236424985855958e-66) --
                    (-4.9, 5.31411488307728e-07) --
                    (-4.8, 3.95549527961044e-06) --
                    (-4.7, 4.303030142791807e-06) --
                    (-4.6, 6.842013588090742e-07) --
                    (-4.5, 9.236424985855951e-66) --
                    (-4.4, 8.173433869377619e-07) --
                    (-4.3, 6.141748066122749e-06) --
                    (-4.2, 6.747900318735658e-06) --
                    (-4.1, 1.0841261802423652e-06) --
                    (-4.0, 9.236424985855951e-66) --
                    (-3.9, 1.3242099017039712e-06) --
                    (-3.8, 1.0070045517514694e-05) --
                    (-3.7, 1.1203634282331384e-05) --
                    (-3.6, 1.8239177759725472e-06) --
                    (-3.5, 9.236424985855951e-66) --
                    (-3.4, 2.2924485153493843e-06) --
                    (-3.3, 1.7705576029270517e-05) --
                    (-3.2, 2.0024694853027794e-05) --
                    (-3.1, 3.3171757645011927e-06) --
                    (-3.0, 9.236424985855951e-66) --
                    (-2.9, 4.331349886689919e-06) --
                    (-2.8, 3.4161245363599325e-05) --
                    (-2.7, 3.951033968062021e-05) --
                    (-2.6, 6.70381262737629e-06) --
                    (-2.5, 9.236424985855958e-66) --
                    (-2.4, 9.233583740861088e-06) --
                    (-2.3, 7.503337405958586e-05) --
                    (-2.2, 8.963447864818203e-05) --
                    (-2.1, 1.5752086215146527e-05) --
                    (-2.0, 9.236424985855951e-66) --
                    (-1.9, 2.3507197452505176e-05) --
                    (-1.8, 0.0002000210946331401) --
                    (-1.7, 0.00025140281402531684) --
                    (-1.6, 4.6745017688109035e-05) --
                    (-1.5, 9.236424985855951e-66) --
                    (-1.4, 7.974493646417963e-05) --
                    (-1.3, 0.0007351778449707119) --
                    (-1.2, 0.0010126067915802706) --
                    (-1.1, 0.00020923990705607045) --
                    (-1.0, 9.236424985855951e-66) --
                    (-0.9, 0.0004669229506489748) --
                    (-0.8, 0.005126321882375121) --
                    (-0.7, 0.00874527881308142) --
                    (-0.6, 0.002363797437660431) --
                    (-0.5, 9.236424985855951e-66) --
                    (-0.4, 0.011966724528155946) --
                    (-0.3, 0.2592273386445493) --
                    (-0.2, 1.312338401888031) --
                    (-0.1, 3.06348147920792) --
                    (0.0, 4) --
                    (0.1, 3.06348147920792) --
                    (0.2, 1.312338401888031) --
                    (0.3, 0.2592273386445493) --
                    (0.4, 0.011966724528155946) --
                    (0.5, 9.236424985855951e-66) --
                    (0.6, 0.002363797437660431) --
                    (0.7, 0.00874527881308142) --
                    (0.8, 0.005126321882375121) --
                    (0.9, 0.0004669229506489748) --
                    (1.0, 9.236424985855951e-66) --
                    (1.1, 0.00020923990705607045) --
                    (1.2, 0.0010126067915802706) --
                    (1.3, 0.0007351778449707119) --
                    (1.4, 7.974493646417963e-05) --
                    (1.5, 9.236424985855951e-66) --
                    (1.6, 4.6745017688109035e-05) --
                    (1.7, 0.00025140281402531684) --
                    (1.8, 0.0002000210946331401) --
                    (1.9, 2.3507197452505176e-05) --
                    (2.0, 9.236424985855951e-66) --
                    (2.1, 1.5752086215146527e-05) --
                    (2.2, 8.963447864818203e-05) --
                    (2.3, 7.503337405958586e-05) --
                    (2.4, 9.233583740861088e-06) --
                    (2.5, 9.236424985855958e-66) --
                    (2.6, 6.70381262737629e-06) --
                    (2.7, 3.951033968062021e-05) --
                    (2.8, 3.4161245363599325e-05) --
                    (2.9, 4.331349886689919e-06) --
                    (3.0, 9.236424985855951e-66) --
                    (3.1, 3.3171757645011927e-06) --
                    (3.2, 2.0024694853027794e-05) --
                    (3.3, 1.7705576029270517e-05) --
                    (3.4, 2.2924485153493843e-06) --
                    (3.5, 9.236424985855951e-66) --
                    (3.6, 1.8239177759725472e-06) --
                    (3.7, 1.1203634282331384e-05) --
                    (3.8, 1.0070045517514694e-05) --
                    (3.9, 1.3242099017039712e-06) --
                    (4.0, 9.236424985855951e-66) --
                    (4.1, 1.0841261802423652e-06) --
                    (4.2, 6.747900318735658e-06) --
                    (4.3, 6.141748066122749e-06) --
                    (4.4, 8.173433869377619e-07) --
                    (4.5, 9.236424985855951e-66) --
                    (4.6, 6.842013588090742e-07) --
                    (4.7, 4.303030142791807e-06) --
                    (4.8, 3.95549527961044e-06) --
                    (4.9, 5.31411488307728e-07) --
                    (5.0, 9.236424985855958e-66) --
                    (5.1, 4.528293363652966e-07) --
                    (5.2, 2.8717884569168376e-06) --
                    (5.3, 2.661107026328134e-06) --
                    (5.4, 3.602800545131002e-07) --
                    (5.5, 1.6166354311481645e-63) --
                    (5.6, 3.1150365806319875e-07) --
                    (5.7, 1.9891447935831516e-06) --
                    (5.8, 1.8554696109297905e-06) --
                    (5.9, 2.5281754659351027e-07) --
                    (6.0, 9.236424985855951e-66) --
                    (6.1, 2.2125643933133683e-07) --
                    (6.2, 1.4210163081164671e-06) --
                    (6.3, 1.3329185814786595e-06) --
                    (6.4, 1.825977253441778e-07) --
                    (6.5, 2.1247489470901966e-65) --
                    (6.6, 1.6145054556795375e-07) --
                    (6.7, 1.0419973375281967e-06) --
                    (6.8, 9.82042242286396e-07) --
                    (6.9, 1.351508856906833e-07) --
                    (7.0, 9.236424985855951e-66)
                    ;

            \end{tikzpicture}
            \end{center}

    \subsubsection{Que vaut $\int_{\mathbb{R}} S_x(f) \dif f$~?}

        Calculer l'intégrale dans le domaine fréquentiel serait compliqué.
        Mais d'après le théorême de Parseval~:

        \begin{align*}
            E = \int_{\mathbb{R}} S_x(f) \dif f
            &= \int_{\mathbb{R}} |x(t)|^2 \dif t \\
            &= \int_{-\pi/2}^{\pi/2} A^2 \dif t \\
            &= A^2 [t]_{-T/2}^{T/2} \\
            &= A^2 T
        \end{align*}

\section{II}

\end{document}
