주파수 대역폭 플로팅

주파수 대역폭 플로팅

나는 경험이 거의 없으며 pgfplot정말 쉬워 보이는 것에 몇 가지 문제가 있습니다.

내가 하고 싶은 것은 함수와 수평선의 교차점으로 식별되는 두 수직선과 함수 사이의 영역을 채우는 것입니다.

교차점을 찾았고 수직선을 올바르게 그릴 수 있었지만 영역을 채우는 방법을 이해할 수 없습니다.

다음은 지금까지 생성한 코드입니다.

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\usetikzlibrary{calc,intersections}






\begin{document}

\begin{figure}
\centering
\begin{tikzpicture}
\begin{axis}[scale=1]
\addplot+[name path global=GraphCurve, domain=0.5:1.5, samples=400, color=black, mark=none]{0.09*x^2/sqrt((1-x^2)^2+(0.09*x)^2)};

\addplot+[name path global=HorizontalLine, domain=0.5:1.5,mark=none, opacity=0]{0.5};

\path[dashed,name intersections={of=GraphCurve and HorizontalLine,name=i}] (i-2)%
      \pgfextra{\pgfgetlastxy{\macrox}{\macroy}%
         \global\let\macrox\macrox};
         \def \xinta {\macrox}
 \draw[name path global=vert1, dashed](i-2) -- (\xinta,0);        
 \path (i-1)
         \pgfextra{\pgfgetlastxy{\macrox}{\macroy}%
         \global\let\macrox\macrox};
              \def \xintb {\macrox} 

\draw[name path global=vert2,dashed](i-1) -- (\xintb,0);
\coordinate [label=left:$A$](A) at (i-1);
\coordinate [label=right:$B$](B) at (i-2);


\end{axis}
\end{tikzpicture}
\caption{This picture has been created with Pgfplots}
\end{figure}

\end{document}

누구든지 도와줄 수 있나요?

답변1

나는 그것을 잘라낼 것이다.

암호

\documentclass[tikz]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.7}
\usetikzlibrary{calc,intersections,backgrounds}
\begin{document}
\begin{tikzpicture}
\begin{axis}
\addplot+[name path global=GraphCurve, domain=0.5:1.5, samples=400, color=black, mark=none]{0.09*x^2/sqrt((1-x^2)^2+(0.09*x)^2)};

\addplot+[name path global=HorizontalLine, domain=0.5:1.5,mark=none, opacity=0]{0.5};

\path [name intersections={of=GraphCurve and HorizontalLine,name=i}];

\draw[dashed] (i-1) coordinate[label=left:$A$] -- ({axis cs:0,0} -| i-1);
\draw[dashed] (i-2) coordinate[label=right:$B$] -- ({axis cs:0,0} -| i-2);

\begin{scope}[on background layer]
    \clip ({axis cs:0,0} -| i-1) rectangle ({axis cs:0,\pgfkeysvalueof{/pgfplots/ymax}} -| i-2);
    \addplot+ [domain=0.5:1.5, samples=400, draw=none, mark=none, fill=gray] {0.09*x^2/sqrt((1-x^2)^2+(0.09*x)^2)} \closedcycle;
\end{scope}
\end{axis}
\end{tikzpicture}
\end{document}

산출

여기에 이미지 설명을 입력하세요

관련 정보