I'm using an example I found online: https://texample.net/tikz/examples/control-system-principles/, to draw this diagram:
so far I have:
\documentclass{article}
\usepackage{lmodern}
\usepackage{graphicx}
\usepackage{lscape}
\usepackage{tocbibind}
\usepackage{listings}
\usepackage{tikz}
\usepackage{amsmath}
\usetikzlibrary{shapes, arrows.meta, arrows, positioning}
\begin{document}
\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, circle, node distance=1.5cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\begin{tikzpicture}[auto, node distance=3cm,>=latex']
\node [input, name=input] {};
\node [block, right of=input] (controller) {{$\dot x = Ax(t) + Bu(t)$}};
\draw [draw,->] (input) -- node {$u$} (controller);
\node [block, right of=controller,
node distance=4cm] (system) {C};
\node [output, right of=system] (output) {};
\draw [->] (system) -- node [name=y] {$y$}(output);
\node [block, below of=controller] (new controller) {{$\dot{\hat{x}} = \hat{A}\hat{x}(t) + \hat{B}u(t)$}};
\node [block, right of=new controller,
node distance=4cm] (new system) {$\hat{C}$};
\node [output, right of=new system] (new output) {};
\node[sum, right of =new output] (sum) {};
\draw [->] (new system) -- node [name=y] {$\hat{y}$}(new output);
\node [block, below of=new system] (observer) {{$L$}};
\draw [->] (controller) -- node[name=u] {$x$} (system);
\draw [->] (new controller) -- node[name=u] {$\hat{x}$} (new system);
\end{tikzpicture}
\end{document}
and I'm stuck with getting the circle/sum node at the end or edge of y hat. It is too far out. any help with drawing this diagram would be appreciated, as I've been stuck with the sum node position for a while. many thanks!
edit 1: edited and included packages and such as it wasn't included before, apologies! (I've included other packages as this is a part of a greater file and is just a section). Would also appreciate if possible if L had an arrow going into xhat(t)=... as shown in the diagram please!
edit 2: thank you to Rushi and Zarko for their help. it helped me improve mine, and I used things I learnt from both codes to produce:
the code being:
\documentclass{article}
\usepackage{tikz}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usetikzlibrary{shapes, arrows.meta,arrows, positioning,chains, quotes}
\begin{document}
\tikzstyle{block} = [draw, rectangle, minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, circle, node distance=1.5cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]
\begin{tikzpicture}[auto,>=latex']
\node [input, name=input] {};
\node [block, right=1cm of input] (system) {{$\dot x = Ax(t) + Bu(t)$}};
\node [block, right=1cm of system] (C) {C};
\node [output, right=2cm of C] (output) {};
\node [block, below=1cm of system] (observer) {{$\dot{\hat{x}} = \hat{A}\hat{x}(t) + \hat{B}u(t)$}};
\node [block, right=1cm of observer] (CHat) {$\hat{C}$};
\node [output, right=1cm of CHat] (new output) {};
\node [sum] at (output |- CHat) (sum) {};
\node [block, below=1cm of CHat] (L) {{$L$}};
\draw [-] (input) -- ++(-1,0);
\draw [->] (input) -- node {$u$} (system);
\draw [-] (C) -- node [name=y] {$y$} (output);
\draw [->] (output) -- ++(1,0);
\draw [->] (CHat) -- node [name=y] {$\hat{y}$} node [below,at end] {$-$} (sum);
\draw [->] (system) -- node [name=x] {$x$} (C);
\draw [->] (observer) -- node [name=xHat] {$\hat{x}$} (CHat);
\draw [->] (output) -- (sum);
\draw [->] (sum) |- node[name=u] [right, near start] {$e$} (L);
\draw [->] (input) |- (observer);
%\draw [->] (L) -| (observer);
\draw [->] (L) -- (input |- L) |- ([yshift=-1ex] observer.west);
\draw [->] (xHat) -- ++(0,-4);
\end{tikzpicture}
\end{document}