3

I am trying to draw the diagram in the attached picture. I have not been able to accomplish two tasks after several hours. Thank you for your help

  1. Write the equation shown below in the plant rectangle box.
   \dot{x} = f(x, \alpha(x, \theta)) \\
   y = h(x)
\end{align*}
  1. Attach a straight line in the middle of the line joining the "sum" and "times" node as shown in the attached picture.

The Figure I am trying to draw: enter image description here

My current result enter image description here

My code

\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows}
\usetikzlibrary{backgrounds,fit,shapes}
\begin{document}
\begin{figure}[ht]
    \centering
        \begin{tikzpicture}
        % Sum shape
    \node[draw=black, 
        circle,
        minimum size=0.8cm,
       % fill=green!10
        ] (sum) at (0,0){$\large + $};

        % Integrator
        \node [draw=black, 

% fill=green, minimum width=1.5cm, minimum height=1.2cm, right=1cm of sum, ] (Integrator) {\large $\frac{k}{s}$};

     % low pass filter
        \node [draw=black, 

% fill=green, minimum width=1.5cm, minimum height=1.2cm, right=1cm of Integrator, ] (lowfilter) {\large $\frac{\omega_l}{s + \omega_l}$};

  % times shape
    \node[draw=black, 
        circle,
        minimum size=0.8cm,
        right=1cm of lowfilter,
        ] (times){$\large \times$} ;

         % High pass filter
        \node [draw=black, 

% fill=green, minimum width=1.5cm, minimum height=1.2cm, right=1.5cm of times, ] (highfilter) {\large $\frac{s}{s + \omega_h}$}; %====================================================================== % I want to write equation inside this rectangle %\begin{align} % \dot{x} = f(x, \alpha(x, \theta)) \ % y = h(x) %\end{align} % Plant \node [draw=black, % fill=green, minimum width=4cm, minimum height=2cm, above=2cm of times, ] (plant) {\large $\dot{x} = f(x, \alpha(x, \theta)) $ };
% ] (plant) {\begin{align} % \dot{x} = f(x, \alpha(x, \theta)) % \end{align}}; % $\dot{x} = f(x, \alpha(x, \theta)) $ };

\draw[-stealth] (highfilter.west) -- (times.east)
node[midway,above]{$y -\eta $};

 \draw[-stealth] (times.west) -- (lowfilter.east);

% node[midway,above]{};

\draw[-stealth] (lowfilter.west) -- (Integrator.east)
node[midway,above]{$\xi$};

  \draw[-stealth] (Integrator.west) -- (sum.east)
node[midway,above]{$\hat{\theta}$};

    \draw[-stealth] (sum.north) |-  (plant.west);

\draw[-stealth] (plant.east) -- ++ (4,0) nodenear end{}node[near end,above]{$y$};

   \draw[-stealth] (output.center) |-  (highfilter.east);

   \draw[stealth-stealth] (times.south) --++ (0, -1) -| (sum.south)
   node[midway](connector){};

   %\draw[-stealth] (connector.center) --++ (0, -1);




    \end{tikzpicture}
\caption{Caption}
\label{fig:my_label}

\end{figure} \end{document}

Tee
  • 147
  • 1
    Use aligned instead of align (or gathered if you don't want alignment), i.e. the inline versions of the math environments. You could also specify a text width for the node which would make the "normal" environments work again but I don't see a reason to do it that way. – Qrrbrbirlbel Dec 20 '22 at 18:15
  • 1
    I'd argue, this is all covered in Q1342 unless you have a follow-up. – Qrrbrbirlbel Dec 20 '22 at 18:17
  • 1
    Add coordinate[near start, pin=below:{$\alpha\sin \omega t$}] between -| and (sum.south). If it complains, give the coordinate a name. (Or just use a named coordinate and draw a separate line and node in relation to it.) – Qrrbrbirlbel Dec 20 '22 at 18:51
  • @Qrrbrbirlbel your suggestions solved it – Tee Dec 20 '22 at 22:20

1 Answers1

2

Like this:

enter image description here

The simplest way to write plant equation system is use aligned environment of amsmath package. I took a liberty and define styles for scheme elements and sightly redesign its input part. By this scheme code is shorter and (hopefully) more clear.

Edit: added is missing input part of scheme.

%\documentclass{article}
\documentclass[margin=3mm]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                backgrounds,
                fit,
                positioning,
                quotes}
\newcommand\ppbb{path picture bounding box}

\begin{document} % \begin{figure}[ht] % \centering \begin{tikzpicture}[auto=right, node distance = 8mm and 12mm, dot/.style = {circle, fill, minimum size=3pt, inner sep=0pt, node contents={}}, shorten <>/.style = {shorten <=#1, shorten >=#1}, sum/.style = {circle, draw=black, minimum size=6mm, path picture={\draw[very thick,shorten <>=1mm] (\ppbb.north) edge[-] (\ppbb.south) (\ppbb.west) -- (\ppbb.east);}, node contents={}}, % Sum shape mul/.style = {circle, draw=black, minimum size=6mm, path picture={\draw[very thick,shorten <>=1mm] (\ppbb.north west) edge[-] (\ppbb.south east) (\ppbb.south west) -- (\ppbb.north east);}, node contents={}}, N/.style = {draw, minimum size=12mm, align=center, font=\large}, every edge/.append style = {draw, -Stealth} ] % blocks \node (sum) [sum]; \node (int) [N, right=of sum] {$\frac{k}{s}$}; \node (LPF) [N, right=of int] {$\frac{\omega_l}{s + \omega_l}$}; \node (mul) [mul, right=of LPF]; \node (HPF) [N, right=of mul] {$\frac{s}{s + \omega_h}$}; % \node (plant) [N, above=of mul] {$\begin{aligned} % <---- \dot{x} & = f(x, \alpha(x,\theta))\ y & = h(x) \end{aligned}$}; \node (out) [dot, right=of plant-| HPF.east, label=$y$]; % \node (in) [dot, below=of sum]; %% lines \path (HPF) edge["$y-\eta$"] (mul) (mul) edge (LPF) (LPF) edge["$\xi$"] (int) (int) edge["$\hat{\theta}$"] (sum) (in) edge (sum) (out) edge ++ (1.2,0); % \draw[-Stealth] (sum) |- (plant) node[pos=0.9, above] {$\theta$}; \draw[-Stealth] (plant) -- (out) |- (HPF); % \draw (in) to["$a\sin\omega t$"] ++ (-2,0); \draw[-Stealth] (in) -| (mul); \end{tikzpicture} % \caption{Caption} % \label{fig:my_label} % \end{figure} \end{document}

Zarko
  • 296,517