1

in order to describe the voltages and currents of a push pull converter, I have set up certain diagrams. My plan was, to define a command that would draw the coordinate system which then I would fill with the the drawing of the voltages. The way I have done it (using an example of texample) however gives me a headache. I got the coordinate system all set up, but how can I fill it with data underneath /begin{document}?

I don't have a repetitive function that would describe the voltages. Rather these are all simple PWL signals. How can I draw these into the created diagrams?

% Phasor diagram % http://texample.net/tikz/examples/phasor-diagram/
% Author: Urs Zellweger ([email protected])
\documentclass[11pt]{article}
\usepackage{tikz}
\usepgfmodule{shapes}
\usepgfmodule{plot}
\usepackage{pgfplots}
 \pgfplotsset{compat=1.15}

\usetikzlibrary{decorations}
\usetikzlibrary{arrows}

\newcommand{\Gitter}[4]{
    \draw[very thin,color=gray] (#1,#3) grid (#2,#4);
}
\newcommand{\Koordinatenkreuz}[6]{
    \draw[->, >=latex, color=green!50!black] (#1,0) -- (#2,0) node[right] {#5};
    \draw[->, >=latex, color=green!50!black] (0,#3) -- (0,#4) node[left] {#6};
}

\newcommand{\Diagramm}[5]{
\begin{tikzpicture}
    \def\T{#1}
    \def\Thalf{#2}
    \def\DT{#3}
    \def\Label{#4}

    \Gitter{-.1}{10.1}{-3.1}{3.1}
    \Koordinatenkreuz{-.2}{10.3}{-3.2}{3.3}{$t$}{#4};
    \draw (#1,0) node[below]{$T$};
    \draw (#2,0) node[below]{$\frac{T}{2}$};
    \draw (#3,0) node[below]{$DT$};

\end{tikzpicture}
}

\begin{document}


% {T}{T/2}{DT}{y-Label}{reserved}

\Diagramm{8}{4}{2}{$U_{GS,1,4}$}{}

\Diagramm{8}{4}{2}{$U_{GS,2,3}$}{}





\end{document}
1
  • Both pgfplots and tikz data visualization create their own coordinate systems. You can add a grid later (possibly on the background layer). Oct 30, 2017 at 13:53

1 Answer 1

2

If you change the \Diagramm macro to an environment instead, as in the code below, you can use \draw etc. in the environment. That said, I would recommend you have a look at what pgfplots does. You load it in your preamble, but you don't use it.

% Phasor diagram % http://texample.net/tikz/examples/phasor-diagram/
% Author: Urs Zellweger ([email protected])
\documentclass[11pt]{article}
\usepackage{tikz}

\usetikzlibrary{decorations}
\usetikzlibrary{arrows}

\newcommand{\Gitter}[4]{
    \draw[very thin,color=gray] (#1,#3) grid (#2,#4);
}
\newcommand{\Koordinatenkreuz}[6]{
    \draw[->, >=latex, color=green!50!black] (#1,0) -- (#2,0) node[right] {#5};
    \draw[->, >=latex, color=green!50!black] (0,#3) -- (0,#4) node[left] {#6};
}

\newenvironment{Diagramm}[5]{
\begin{tikzpicture}
    \def\T{#1}
    \def\Thalf{#2}
    \def\DT{#3}
    \def\Label{#4}

    \Gitter{-.1}{10.1}{-3.1}{3.1}
    \Koordinatenkreuz{-.2}{10.3}{-3.2}{3.3}{$t$}{#4};
    \draw (#1,0) node[below]{$T$};
    \draw (#2,0) node[below]{$\frac{T}{2}$};
    \draw (#3,0) node[below]{$DT$};
}
{\end{tikzpicture}}

\begin{document}


% {T}{T/2}{DT}{y-Label}{reserved}

\begin{Diagramm}{8}{4}{2}{$U_{GS,1,4}$}{}

\draw [thick,red] (0,1) -- (2,0) -- (4,2);

\end{Diagramm}

\begin{Diagramm}{8}{4}{2}{$U_{GS,2,3}$}{}
\end{Diagramm}

\end{document}
1
  • Thanks a lot. Pgfplots in added unintentionally from the template. Won't be needing it. Thanks again.
    – SF6
    Oct 30, 2017 at 20:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .