这是我的文本
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
$x = \hat{x}\cdot\frac{\omega_0^2}{\sqrt{\left(\omega_0^2-\omega_E^2\right)^2+4\cdot \delta^2 \cdot \omega_E^2}}$\\
\begin{tikzpicture}
% Plot Function
\begin{axis}[
xmin=8,
xmax=35,
ymin=0,
ymax=25,
]
% \delta
\def\kd{0.82}
% \omega_0
\def\kw{16.9}
% \hat{x}
\def\kx{2}
\addplot[samples=500, very thick] {\kx*\kw^2/(sqrt{(\kw^2-x^2)^2+4*\kd^2*x^2})};
\end{axis}
\end{tikzpicture}
\end{document}
我得到了
但我期望(使用 EXCEL 绘制相同的函数)
答案1
\documentclass[tikz, border=1cm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xmin=8, xmax=35,
ymin=0, ymax=25,
]
\pgfmathsetmacro{\kd}{0.82}
\pgfmathsetmacro{\kw}{16.9}
\pgfmathsetmacro{\kx}{2}
\addplot[domain=0:35, samples=200, very thick, smooth] {\kx*\kw^2/(sqrt((\kw^2-x^2)^2+4*\kd^2*x^2))};
\end{axis}
\end{tikzpicture}
\end{document}