我编写了这段代码来绘制 NTC 电阻器随温度变化的电阻图。我知道它具有反比形式,但我无法让它绘制出这样一种图,即不经过每个点,而是保持反比函数的形式。我该如何改变它以使其具有这种形式?
%\usepackage{pgfplots}
\begin{center}
\begin{tikzpicture}
\begin{axis}[
title={\textbf{Grafiek 1 aan de hand van \textit{Tabel 2}}},
xlabel = {$T$($^\circ$C)},
ylabel = {$R_{\mathrm{NTC}}$},
xmin = 20, xmax = 72,
ymin = 0, ymax = 50,
xtick = {0,10,20,30,40,50,60,70,80},
ytick = {0,10,20,30,40,50,60,70,80},
ymajorgrids = true,
grid style = dashed,
]
\addplot[
color = blue,
mark = *,
smooth,
]
coordinates {
(22,49.9)(25,45.5)(28,41.1)(33,36.2)(36,31.6)(40,28.6)(45,23.7)(48,21.6)
(51,20.5)(55,18.1)(58,16.5)(63,14.9)(72,10.8)};
\end{axis}
\end{tikzpicture}
\end{center}
答案1
\documentclass[margin=3mm]{standalone}
\usepackage{siunitx}
\usepackage{pgfplots}
\pgfplotsset{width=8cm,compat=1.14}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
title={\textbf{Grafiek 1 aan de hand van \textit{Tabel 2}}},
xlabel = {$T$ (\si{\degreeCelsius})},
ylabel = {$R_{\mathrm{NTC}}$},
xmin = 20, xmax = 80,
ymin = 0, ymax = 50,
ymajorgrids = true,
grid style = dashed,
]
\addplot[blue,
domain=20:80, % <-- added
samples=7, % <-- added
mark = *,
smooth]
{1000/x}; % <-- changed
\end{axis}
\end{tikzpicture}
\end{document}