如何从两个 pgfplots 的交集创建 pgfplotstable?

如何从两个 pgfplots 的交集创建 pgfplotstable?

我正在尝试找到 pgfplots 中的交点 2 个图并将 x 值提取到 pgfplotstable 上?

这是 Symm 和 Load 图相交的代码,我可以获取交点的 x 值,但是当我尝试使用 存储该值时\pgfplotstableread,出现错误。此外,当我尝试将行值附加到 时,会弹出错误table1

在此处输入图片描述

%% Preamble    
%For getting gnuplot coordinates
\newlength{\len}
\newlength{\plotwidth}
\newlength{\het}
\newlength{\plotheight}

\newcommand{\getvalue}[1]{\pgfkeysvalueof{/pgfplots/#1}}
\begin{document}
\begin{figure}
\pgfplotsset{
 compat=1.11,
 /pgf/declare function={
% drain current above pinch off
Ida(\Kn,\lamda,\WL,\Vg,\Vt,\Vd)=0.5*\Kn*\WL*(\Vg-\Vt)^2;
Idb(\Kn,\lamda,\WL,\Vg,\Vt,\Vd)=0.5*\Kn*\WL*(\Vg-\Vt)^2*(1+(\lamda*\Vd));
% drain current below pinch off
Idc(\Kn,\lamda,\WL,\Vg,\Vt,\Vd)=0.5*\Kn*\WL*(2*(\Vg-\Vt)-\Vd)*\Vd;
},
}
\begin{tikzpicture}[transform shape, scale=0.75]
%%
\begin{axis}[
width=\textwidth,
%height=\textwidth,
xmin=-0.1, xmax=15.5,
ymin=-0.1,ymax=5,
axis line style={<->},
samples=101,
axis x line=middle,
axis y line=middle,
ticks=none,
]
\def\Vdd{3}
\def\Kn{50*10^(-3)}
\def\WL{10}
\def\lamda{0.001}
\def\Vt{0.7}
\def\Rd{1}

\pgfplotstableread[row sep=\\,col sep=comma, columns={x,y}]{
x,y \\
1, 13 \\
}\table1%

\addplot[draw=none,name path global={load}, blue, samples=10, domain=0:15]{5-(\x/3)};

\pgfplotsinvokeforeach{2,...,10}{
\addplot[name path global={Symm}, smooth, cyan, samples=101, domain=0:15] {
    (\x<#1*0.5-\Vt) ? Idc(\Kn,\lamda,\WL,#1*0.5,\Vt,\x) : Idb(\Kn,\lamda,\WL,#1*0.5,\Vt,\x)
     };
     \path[name intersections={of={Symm} and {load}, by={point#1}, name=j}](j-1)
\pgfextra{
    \pgfextractx{\len}{\pgfpointdiff{\pgfplotspointaxisxy{0}{0}}{\pgfpointanchor{j-1}{center}}}
    \pgfextractx{\plotwidth}{\pgfpointdiff{\pgfplotspointaxisxy{\getvalue{xmin}}{0}}%
    {\pgfplotspointaxisxy{\getvalue{xmax}}{0}}}%
    \pgfmathparse{\len/\plotwidth*15}%since xmax=15
    \global\let\macrox\pgfmathresult%
    \xdef\intsectX{\getvalue{xmax}}%
}   
    (j-1)node[circ]{}node[left]{\macrox};

\pgfplotstableread[row sep=\\,col sep=comma, columns={x,y},
columns/y/.style={numeric type}
]{
x,y \\
1, \macrox \\   <- *Error 1: ! Package PGF Math Error: Could not parse input '' as a floating point number, sorry. The unreadable part was near ''..*
}\sum%

    % Concatenate


%%% <- Error 2: ! Undefined control sequence. \sum ->\pgfpl@@{x}\pgfpl@@ {y }l.378 };
 %  \pgfplotstablevertcat{\table1}{\sum} 

    };  
\pgfplotstabletypeset\sum%  

\end{axis}
\end{tikzpicture}
\end{figure}
\end{document}

相关内容