如何在乳胶中绘制八角模糊数的图形?

如何在乳胶中绘制八角模糊数的图形?

如果成员函数如下,那么如何在 Latex 中绘制它的图形?在此处输入图片描述

答案1

只需使用 pgfplots (我添加了一些您可以尝试的参数):

\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{math}
\begin{document}
    \begin{tikzpicture}
        \tikzmath{
            real \k;
            real \a0;
            real \a1;
            real \a2;
            real \a3;
            real \a4;
            real \a5;
            real \a6;
            real \a7;
            real \a8;
            \k=3.0;
            \a0=-5.0;
            \a1= -3.0;
            \a2= 2.0;
            \a3= 4.0;
            \a4= 5.0;
            \a5= 9.0;
            \a6= 10.0;
            \a7= 11.0;
            \a8= 12.0;
            \a9=14.0;
        };
    \begin{axis} [grid=major,legend style={overlay},every axis plot post/.append style={mark=none}]
        \addplot [domain = \a0:\a1,color=blue]
        {0};
        \addplot [domain = \a1:\a2,color=blue]
        {\k*(x-\a1)/(\a2-\a1)};
        \addplot [domain = \a2:\a3,color=blue]
        {\k};
        \addplot [domain = \a3:\a4,color=blue]
        {\k + (1-\k)*(x-\a3)/(\a4-\a3)};
        \addplot [domain = \a4:\a5,color=blue]
        {1};
        \addplot [domain = \a5:\a6,color=blue]
        {\k + (1-\k)*(\a6-x)/(\a6-\a5)};
        \addplot [domain = \a6:\a7,color=blue]
        {\k};
        \addplot [domain = \a7:\a8,color=blue]
        {\k*(\a8-x)/(\a8-\a7)};
        \addplot [domain = \a8:\a9,color=blue]
        {0};
        
    \end{axis}
\end{tikzpicture}
\end{document}

可以通过调整所谓的刻度来添加特定的 x 坐标:

\documentclass{standalone}
\usepackage{pgfplots}
\usetikzlibrary{math}
\begin{document}
    \begin{tikzpicture}
        \tikzmath{
            real \k;
            real \a0;
            real \a1;
            real \a2;
            real \a3;
            real \a4;
            real \a5;
            real \a6;
            real \a7;
            real \a8;
            \k=3.0;
            \a0=-5.0;
            \a1= -3.0;
            \a2= 2.0;
            \a3= 4.0;
            \a4= 6.0;
            \a5= 9.0;
            \a6= 11.0;
            \a7= 13.0;
            \a8= 15.0;
            \a9= 17.0;
        };
    \begin{axis} [grid=major,legend style={overlay},every axis plot post/.append style={mark=None},xtick={\a1,\a2,\a3,\a4,\a5,\a6,\a7,\a8},
            xticklabels={$a_1$,$a_2$,$a_3$,$a_4$,$a_5$,$a_6$,$a_7$,$a_8$}]
        \addplot [domain = \a0:\a1,samples=2,color=blue]
        {0};
        \addplot [domain = \a1:\a2,samples=2,color=blue]
        {\k*(x-\a1)/(\a2-\a1)};
        \addplot [domain = \a2:\a3,samples=2,color=blue]
        {\k};
        \addplot [domain = \a3:\a4,samples=2,color=blue]
        {\k + (1-\k)*(x-\a3)/(\a4-\a3)};
        \addplot [domain = \a4:\a5,samples=2,color=blue]
        {1};
        \addplot [domain = \a5:\a6,samples=2,color=blue]
        {\k + (1-\k)*(\a6-x)/(\a6-\a5)};
        \addplot [domain = \a6:\a7,samples=2,color=blue]
        {\k};
        \addplot [domain = \a7:\a8,samples=2,color=blue]
        {\k*(\a8-x)/(\a8-\a7)};
        \addplot [domain = \a8:\a9,samples=2,color=blue]
        {0};
        
        %\legend{$B^3_0(t)$,$B^3_1(t)$,$B^3_2(t)$,$B^3_3(t)$}
    \end{axis}
\end{tikzpicture}
\end{document}

相关内容