
PGF 플롯에서 이것을 달성하는 것이 가능합니까? 사인파를 얻을 수 있고 톱니 모양의 파동을 그릴 수 있지만 모두 함께 얻을 수는 없습니다.
답변1
루프를 사용하지 않고 Jesse의 플롯을 구현하는 또 다른 방법은 abs(sin(x))
정류된 사인파, exp(-(0.0015*mod(x+90,180))
반복 지수 함수 및 max(<function a>, <function b>)
두 가지를 결합하는 것입니다.
\documentclass[border=5mm]{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
domain=0:1.5*360,
samples=4*360,
xtick=\empty,
width=10cm, height=4cm,
ymin=0,
enlarge x limits=false
]
\addplot [densely dashed] {abs(sin(x))};
\addplot [very thick] {max(abs(sin(x)), exp(-(0.0015*mod(x+90,180)))};
\end{axis}
\end{tikzpicture}
\end{document}
답변2
이는 PGFplot을 통한 가능한 솔루션 중 하나입니다. 수정된 곡선은 경사선이 아닌 큰 시간 상수를 갖는 지수적으로 감소하는 함수입니다.
암호
\documentclass{article}
\usepackage{pgfplots}
\usepackage{graphicx}
\begin{document}
\def\arch{1.7*pi/3} %
\begin{figure}[!hbt]
\centering
\begin{tikzpicture}
\begin{axis}[xlabel={$t$},xmin=-3,xmax=21,
ylabel={$i_D$},ymin=0,ymax=5,
axis x line=center,
axis y line=left, enlargelimits=upper]
% draw sine functions
\addplot [dashed,thin,domain=-pi:6*pi,smooth]{-2*sin(deg(0.5*x))};
\addplot [dashed,thin,domain=-pi:6*pi,smooth]{ 2*sin(deg(0.5*x))};
% draw the rectified curves automatically via foreach skill
\foreach \i/\j/\k in {-1/0/1,1/2/3,3/4/5,5/6/7}{
\addplot [thick,domain=\i*pi:{\j*pi+\arch}, ] {2*e^(-0.05*(x-\i*pi)}; % exponentially decay curves, not a line
\addplot [thick,domain={\j*pi+\arch}:\k*pi, smooth]{ 2*sin(deg(0.5*x))};
\addplot [thick,domain={\j*pi+\arch}:\k*pi, smooth]{-2*sin(deg(0.5*x))};
}
\end{axis}
\end{tikzpicture}
\caption{Half-Wave Rectifier Waveform}
\label{halfcycle}
\end{figure}
\end{document}