Originally Posted by

**adkinsjr** So when I create a function with arbitrary constants, for instance $\displaystyle f(x)=\frac{a}{x}-\frac{b}{x^2}$, how can I make multiple plots of this function using different values for the parameters 'a' and 'b' without having to make a separate file for each pair of (a,b).... My function file looks like this,

function Veff = V(x)

a = 1

b = 1

Veff = a*x.^(-1) - b*x.^(-2)

define a and b at the console or in the outer script, then

Code:

function Veff = V(x)
global a
global b
Veff = a*x.^(-1) - b*x.^(-2);

should work, otherwise add them as additional arguments.

.