我所有函数的最后一部分都丢失了。我在这里找到了一些类似的帖子,建议更改域/样本。我尝试了许多不同的样本值,最多 10000 个,但没有一个能解决问题或导致内存错误。有什么想法可以解决这个问题吗?
\documentclass[a4paper,titlepage,12pt]{report}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{caption}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tikz}
\tikzset{>=latex}
\usepackage{pgfplots}
\pgfplotsset{compat=1.15}
\usepackage{mathrsfs}
\usetikzlibrary{graphs,quotes,arrows.meta}
\begin{document}
\begin{figure}[h!]
\centering
\begin{tikzpicture}
\begin{axis}[
unit vector ratio*=1 1 1,
width=\textwidth,
domain=0:18,
xmin=0, xmax=18,
ymin=0, ymax=18,
xtick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17},
ytick={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17},
samples=2000,
axis y line=center,
axis x line=middle,
]
\draw (7,8.5) node[anchor=north west] {$h$};
\addplot+[mark=none, color=black] {(17^3-x^3)^(1/3)};
\addplot+[mark=none, color=black] {(16^3-x^3)^(1/3)};
\addplot+[mark=none, color=black] {(15^3-x^3)^(1/3)};
\addplot+[mark=none, color=black] {(14^3-x^3)^(1/3)};
\addplot+[mark=none, color=black] {(13^3-x^3)^(1/3)};
\addplot+[mark=none, color=black] {x};
\addplot [only marks] table {
8 13
13 13
};
\addplot [only marks, color=red] table {
7 7
10 7
2 3
};
\end{axis}
\end{tikzpicture}
\caption{My caption}
\end{figure}
\end{document}
答案1
按照以下方式更改代码的相应行:
samples=1000,
axis y line=center,
axis x line=middle,
]
\draw (7,8.5) node[anchor=north west] {$h$};
\addplot+[mark=none, domain=0:17,color=black] {(17^3-x^3)^(1/3)};
\addplot+[mark=none, domain=0:16, color=black] {(16^3-x^3)^(1/3)};
\addplot+[mark=none, domain=0:15, color=black] {(15^3-x^3)^(1/3)};
\addplot+[mark=none, domain=0:14,color=black] {(14^3-x^3)^(1/3)};
\addplot+[mark=none, domain=0:13,color=black] {(13^3-x^3)^(1/3)};
现在的输出是: