PGFプロットの電圧グラフ

PGFプロットの電圧グラフ

PGFプロットでこれを実現することは可能でしょうか?正弦波を取得して鋸歯状の波を描くことはできますが、すべてをまとめることはできません。 ここに画像の説明を入力してください

答え1

abs(sin(x))ループを使用せずに Jesse のプロットを実装する別の方法は、整流正弦波に を使用し、exp(-(0.0015*mod(x+90,180))繰り返し指数関数に を使用し、max(<function a>, <function b>)この 2 つを組み合わせることです。

\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

これは、PGFplots による 1 つの可能な解決策です。整流された曲線は、傾斜した線ではなく、大きな時定数を持つ指数関数的に減少する関数です。

ここに画像の説明を入力してください

コード

\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}

関連情報