答案1
这当然不是一个答案(也是因为我不理解这个问题)。我所做的是,按照 Torbjørn T. 的建议,限制第一个图中的域,并替换 Ti钾Zplot
命令\addplot
。(Ti 没有问题钾Zplot
命令,但由于您无论如何都要加载 pgfplots,因此使用可能更合适\addplot
。)我还沿着第二个图的线条画了一些东西,相信您在第一个图中得到的斜率是正确的。
\documentclass[10pt]{article}
\usepackage{pgf,tikz,pgfplots}
\pgfplotsset{compat=1.16}
% \usepackage{mathrsfs}
\usetikzlibrary{arrows}
\pagestyle{empty}
\begin{document}
\definecolor{ffqqqq}{rgb}{1.,0.,0.}
\definecolor{qqqqff}{rgb}{0.,0.,1.}
\definecolor{qqwuqq}{rgb}{0.,0.39215686274509803,0.}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\begin{axis}[
x=1.0cm,y=1.0cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-2.118707736780596,
xmax=5.255760268305019,
ymin=-4.168187134916317,
ymax=0.14792878906557064,
xtick={-2.0,-1.0,...,5.0},
ytick={-4.0,-3.0,...,0.0},]
\clip(-2.118707736780596,-4.168187134916317) rectangle (5.255760268305019,0.14792878906557064);
% \draw[line width=4.pt] (7.811006812257485,-1.2289916284010438) -- (10.458930692000973,-1.2289916284010438);
% \draw[line width=4.pt] (7.78452757346005,-2.261681941501005) -- (10.432451453203537,-2.261681941501005);
% \draw[line width=4.pt] (7.7977671928587675,-1.7453367849510244) -- (10.445691072602255,-1.7453367849510244);
\addplot[line width=2.pt,color=qqwuqq,smooth,samples=100,domain=-2.118707736780596:1]
{0-2.0/3.0*3.141592653589793*0.05*10.2*(3.0*1.0^(2.0)-(x)^(2.0))};
\addplot[line width=2.pt,color=qqqqff,smooth,samples=100,domain=1:5.255760268305019]
{0-4.0/3.0*3.141592653589793*0.05*10.2*1.0/(\x)*1.0^(3.0)};
\draw [line width=1.2pt,dash pattern=on 2pt off 2pt] (1.,-4.168187134916317) -- (1.,0.14792878906557064);
\addplot[line width=2.pt,color=ffqqqq,domain=-2.118707736780596:5.255760268305019]
{(-4.272566012175239--2.1362830077341797*\x)/1.};
\begin{scriptsize}
\draw[color=black] (9.187927229724098,-0.9178605725311839) node {$a = 1$};
\draw[color=black] (8.062559580833117,-1.9505508856311446) node {$G = 0.05$};
\draw[color=black] (8.76425940896514,-1.4342057290811645) node {$\rho = 10.2$};
\draw[color=qqwuqq] (-1.8539153488062472,-0.7589851397465746) node {$f$};
\draw[color=qqqqff] (0.5027369041654571,-6.518219578188664) node {$g$};
\draw[color=black] (1.2044367322974814,-1.9902697438272972) node {$A$};
\draw[color=ffqqqq] (1.9061365604295057,-0.6001097069619652) node {$i$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\begin{axis}[
x=1.0cm,y=1.0cm,
axis lines=middle,
ymajorgrids=true,
xmajorgrids=true,
xmin=-2.118707736780596,
xmax=5.255760268305019,
ymin=-4.168187134916317,
ymax=0.14792878906557064,
xtick={-2.0,-1.0,...,5.0},
ytick={-4.0,-3.0,...,0.0},]
\clip(-2.118707736780596,-4.168187134916317) rectangle (5.255760268305019,0.14792878906557064);
% \draw[line width=4.pt] (7.811006812257485,-1.2289916284010438) -- (10.458930692000973,-1.2289916284010438);
% \draw[line width=4.pt] (7.78452757346005,-2.261681941501005) -- (10.432451453203537,-2.261681941501005);
% \draw[line width=4.pt] (7.7977671928587675,-1.7453367849510244) -- (10.445691072602255,-1.7453367849510244);
\addplot[line width=2.pt,color=qqqqff,smooth,samples=100,domain=1:5.255760268305019]
{0-4.0/3.0*3.141592653589793*0.05*10.2*1.0/(\x)*1.0^(3.0)};
\draw [line width=1.2pt,dash pattern=on 2pt off 2pt] (1.,-4.168187134916317) -- (1.,0.14792878906557064);
\addplot[line width=2.pt,color=qqwuqq,domain=-2.118707736780596:1]
{(-4.272566012175239-2.1362830077341797*(\x-2))/1.};
\begin{scriptsize}
\draw[color=black] (9.187927229724098,-0.9178605725311839) node {$a = 1$};
\draw[color=black] (8.062559580833117,-1.9505508856311446) node {$G = 0.05$};
\draw[color=black] (8.76425940896514,-1.4342057290811645) node {$\rho = 10.2$};
\draw[color=qqwuqq] (-1.8539153488062472,-0.7589851397465746) node {$f$};
\draw[color=qqqqff] (0.5027369041654571,-6.518219578188664) node {$g$};
\draw[color=black] (1.2044367322974814,-1.9902697438272972) node {$A$};
\end{scriptsize}
\end{axis}
\end{tikzpicture}
\end{document}