我需要您帮助我在 Latex 文档中绘制一些函数。我需要在我的报告中绘制两条或更多条曲线,并将它们放在两个段落之间。例如,
f1(x) =abs((Gamma(1/x) - 4x) /Gamma(x+1))
f2(x) =1/(x+2)^3
在间隔[1,15]
标记曲线以及 x 轴和 y 轴。
编辑。我尝试了以下代码,但是不起作用!
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-plot}
\usepackage[margin=0.25in]{geometry}
\usepackage{pgfplots}
\pgfplotsset{width=10cm,compat=1.9}
\usepackage{amsmath,amsfonts,amssymb}
\usepackage{pst-func}
\usepackage{auto-pst-pdf}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture} \begin{axis}[
axis lines = left,
xlabel = \(x\),
ylabel = {\(f(x)\)}, ] %Below the red parabola is defined
\addplot [
domain=1:15,
samples=100,
color=red, ] { gnuplot {=abs((Gamma(1/x) - 4x) /Gamma(x+1))}} ;
\addlegendentry{\(f1\)} %Here the blue parabola is defined
\addplot [
domain=1:15,
samples=100,
color=blue,
]
{1/(x+2)^3}; \addlegendentry{\(f2\)}
\end{axis}
\end{tikzpicture}
\end{document}
答案1
类似这样的?运行lualatex
\documentclass[pstricks,border=10mm]{standalone}
\usepackage{pst-plot}
\usepackage{pst-math}
\begin{document}
\psset{yunit=2}
\begin{pspicture} (0,0)(10,5)
\psaxes{->}(0,0)(10,5)[$x$,0][$f(x)$,90]
\psset{linewidth=1.5pt,plotpoints=500}
\psplot[linecolor=blue]{1}{10}{% ABS((GAMMA(1/x) - 4*x)/GAMMA(x+1))}
1 x div GAMMA 4 x mul sub x 1 add GAMMA div abs }
\psplot[linecolor=red,yunit=5,algebraic]{1}{10}{1/(x+2)^3}
\end{pspicture}
\end{document}