# Nonlinear solver and interpolation of array data

I am using NLsolve to solve a single nonlinear function V = f(V,I), where V is the unknown voltage and I is a given current. The equation involves constraint by an arrester volt-current characteristic curve which I am approximating with an exponential function as shown in the plot below:

The functioning code block is:

``````using NLsolve

I = 8100        #current
A = 613.05      #constant coefficient = constant x Current
B = 466.811     #constant coefficient
Vguess = 7.0e5             #guess voltage
RL = 10e6                  #parallel resistor

#nonlinear solver with exponential curve approximation of VI data
function f!(F, V)
F[1] = V[1] * (1 + A * I / RL) + (B) * 0.5 * exp(9.7e-6 * V[1]) - A * I
end

Vout = nlsolve(f!,[Vguess]).zero
``````

The result is 990784.145

This works, but as is evident in the plot above, the error for certain regions on the curve is rather high. I would like to use the measured data in the nonlinear solver with the solution obtained by interpolation. Does anyone know how that could be done using NLsolve, some other nonlinear solver, or some other method?

``````#Measured Data:
IData = [0,1000,2000,3000,5000,10000,20000,40000]
VData = [0,819300,849500,871000,907000,955000,1052000,1153000]

#Fitted Exponential Curve:
#I = 0.5 * exp(9.7e-6 * V)
``````