![위상차를 이용한 정현파 그리기](https://rvso.com/image/309885/%EC%9C%84%EC%83%81%EC%B0%A8%EB%A5%BC%20%EC%9D%B4%EC%9A%A9%ED%95%9C%20%EC%A0%95%ED%98%84%ED%8C%8C%20%EA%B7%B8%EB%A6%AC%EA%B8%B0.png)
내 첫 번째 목표는 다음 이미지와 유사한 정현파 플롯을 그리는 것이었습니다.
이것이 제가 수행한 작업입니다(이 포럼의 코드 중 하나와 유사).
내가 알고 싶은 것은 (가능한 경우) 정의역에서 정수를 라디안 표현으로 변경하는 방법, 사인파 중 하나의 진폭을 줄이는 방법, 신호(V 및 I), 도메인 축( \theta = wt
) 및 수직 축에 숫자 대신 피크 값( Vm
, )이 있는 수직 축입니다.Im
코드는 다음과 같습니다.
\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}[
trig format plots=rad,
axis lines = middle,
enlargelimits,
clip=false]
\addplot[domain=-2*pi:2*pi,samples=200, red] {sin(x)};
\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}
친애하는.
답변1
글쎄요, 질문이 너무 많아서 너무 졸려요...
\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,
trig format plots=rad,
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, red] {0.5*sin(x)};
\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}