You've got to make some changes in the code but certainly not remaking the whole program.
Here's a two-variable example from the documentation:
SeedRandom[12345];
data = Flatten[Table[{x, y, Exp[.3 x - .7 y] + RandomReal[{-1, 1}]}, {x, 5}, {y, 5}], 1]
NonlinearModelFit[data, Exp[a x + b y], {a, b}, {x, y}]
To remove the effect of y
you can just modify the NonlinearModelFit
statement by removing y
and its associated parameters from the function but leave in y
in the variable list:
NonlinearModelFit[data, Exp[a x], {a, b}, {x, y}]
It would be even better if you removed the associated parameter from the parameter list but that is not necessary (although the result will have - in this case - b -> 1
).