# calling an expression in the document in pgfplot

Say I have the following function which I would like to plot.

$S(z)=\frac{p.(\alpha_H+z.\alpha_W)}{p.(\alpha_H+z.\alpha_W)+\beta_H+z.\beta_W}$


While I could specify it in the \addplot command, I was just wondering whether there might be a more efficient method where I could label it in some sense (since it is already mentioned in the document) and call it by a macro.

In fact I would like to see how it changes by differing values of the parameters additionally.

-

There is no way to plot a function which is prepared for math typesetting. You will need to replicate the function by means of something like

\pgfmathdeclarefunction{S}{1}{\valueP * (\alphaH + \valueZ * \alphaW) / (\valueP*(\alphaH + \valueZ * \alphaW) + \betaH + \valueZ * \betaW)}


with

\def\alphaH{4}
\def\alphaW{5}
...


you can also declare a function with more than one argument instead of defining constants.

-