# Drawing Sinusoids with Phase difference

My first goal was to draw sinusoid plots similar whit these images:

This is what I've done (similar to one code in this forum):

What I'd like to know is (if possible) how to change integral numbers to radians representation in the domain, decrease the amplitude of one of the sine waves, label the signals (V and I), the domain axis (\theta = wt) and the vertical axis with with peak values (Vm, Im) instead of numbers in the vertical axis.

Here is the code:

\documentclass[11pt]{article}

\usepackage{color}
\usepackage{tikz}                           % for flowcharts
%\usepackage[latin1]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
axis lines = middle,
enlargelimits,
clip=false]

\addplot[domain=-2*pi:2*pi,samples=200, blue, dashed] {sin(x-1)};
\draw[dotted,blue!40] (axis cs: 0,1.1) -- (axis cs: 0,0);
\draw[dotted,red!40] (axis cs: 1,1.1) -- (axis cs: 1,0);
\draw[dashed,olive,<->] (axis cs: 0,1.1) -- node[above,text=black,font=\footnotesize]{$\phi$}           (axis cs: 1,1.1);
\end{axis}
\end{tikzpicture}
\end{center}

\end{document}


Best regards.

Well, that is looot of questions and I am very sleepy...

\documentclass[11pt]{article}

\usepackage{color}
\usepackage{tikz}                           % for flowcharts
%\usepackage[latin1]{inputenc}
\usepackage{pgfplots}
\pgfplotsset{compat=1.11}

\begin{document}

\begin{center}
\begin{tikzpicture}
\begin{axis}[
width=\linewidth,
axis lines = middle,
xlabel={$\theta=wt$},
xlabel style={at={(1,0.5)},anchor=west},
enlargelimits,
ytick={\empty},
extra y ticks={1,0.5,0,-0.5,-1},
extra y tick labels={$V_m$,$I_m$,0,$-I_m$,$-V_m$},
xtick={-6.28318, -4.7123889, ..., 6.28318},
xticklabels={
$-2\pi$, $-\frac{3\pi}{2}$, $-\pi$, $\frac{\pi}{2}$, ,
$\frac{\pi}{2}$, $\pi$, $\frac{3\pi}{2}$, $2\pi$},
clip=false]

\addplot[domain=-2*pi:2*pi,samples=200, blue, dashed] {sin(x-2)};
\draw[dotted,blue!40] (axis cs: 0,1.1) -- (axis cs: 0,0);
\draw[dotted,red!40] (axis cs: 1,1.1) -- (axis cs: 1,0);
\draw[dashed,olive,<->] (axis cs: 0,1.1) --
node[above,text=black,font=\footnotesize]{$\phi$} (axis cs: 1,1.1);
\coordinate (P) at (axis cs:1.5*pi,{sin(25)});
\node (labelV) at (axis cs:2*pi,{1+sin(2*pi)}) {Voltage $(V)$};
\draw [red!50!black, thick, dashed, ->, shorten >=2pt] (labelV) -- (P);
\coordinate (Q) at (axis cs:-1.5*pi,{sin(30)});
\node (labelI) at (axis cs:-2*pi,{1+sin(2*pi)}) {Current $(I)$};
\draw [red!50!black, thick, dashed, ->, shorten >=2pt] (labelI) -- (Q);
\end{axis}
\end{tikzpicture}
\end{center}

\end{document}


• You can start from this to achieve perfection. – user11232 Apr 22 '15 at 16:36
• Just perfect, Harish! I'd just like to know what is the logic of the second term of cs:2*pi,{1+sin(2*pi)} – Francisco Maerle Apr 22 '15 at 18:10
• @FranciscoMaerle: Logic was that I was too sleepy to be accurate ;-). Please follow this answer for the job: How to point an equation to a curve. – user11232 Apr 22 '15 at 21:52