Sakil Chowdhury
Sakil Chowdhury

Reputation: 327

Plotting discrete sin wave through Latex

I am trying to plot a sin wave : 3sin(100*pi*t) through latex where t will be in millisecond. I want to draw the discrete signal which was sampled at Fs = 300 samples/sec.

I have tried this code:

\begin{figure}%Sampled sine squence
 \caption{Discrete Time Signal}
    \begin{tikzpicture}

        \begin{axis}[%
            standard,
            domain = 0:15,
            samples = 13,
            xlabel={$n$},
            ylabel={$x[n]$}]

            \addplot+[ycomb,black,thick] {3*sin(100*180*x/13)};

        \end{axis}
    \end{tikzpicture}
\end{figure} 

\end{document}`

but I am getting a different result than the one I am expecting.

enter image description here

My result should be like plot-B here but I am getting plot-A. Any suggestion, how i should do that?

Upvotes: 3

Views: 1603

Answers (1)

Mike Satteson
Mike Satteson

Reputation: 736

The code calls for a ycomb of 13 samples across the domain, which is exactly what you get with plot-A (exclusive of endpoints). I believe that you need

samples = 5,

to achieve the desired result.

Upvotes: 1

Related Questions