Finding parameters of a given function I have this following relation
$$N = \dfrac{(113834700(3000-c)(1-e^{-(Xn)/(3000-c)})}{n}$$
I also have a set of values for $N$ and $X$, these are vectors. So, we have a scatter plot $N$ vs $X$.
We have to fit the data ($N$ and $X$) with the above relation and thereby have to find $c$ and $n$, which are scalars.
How do I do this?
 A: As @JimBaldwin noted in a comment, there really is only 1 free parameter to fit in your equation, $(3000-c)/n$. If your code for nls or another nonlinear curve fitting routine included both $c$ and $n$ as separate parameters, then it would not be surprising for the routine to run with errors: there is an infinite set of $c$ and $n$ paired values that could "fit." So solve that problem by defining another variable, call is $a$:
$$a=\frac{3000-c}{n}.$$
It also can be easier to avoid accidental errors by avoiding unusual or large constant terms. I'd simply divide all the $N$ values by the constant 113834700 to start, so that there's less chance for error in writing the formula to submit to the fitting routine. Let's say:
$$B= \frac{N}{113834700}.$$
Then you are fitting a simple relation:
$$B=a\left(1-e^{-\frac{X}{a}}\right),$$
which will minimize the chance of errors both in your coding and in the routine.
As with any nonlinear fitting, it's important to start with a good initial estimate for your unknown parameter $a$, and to be prepared to test carefully to make sure that you have found a global minimum for residual squared error rather than some local minimum. I have some examples of R code for nls on this page in a similar context, which illustrates some of the considerations.
Also, make sure that the value of 113834700 is truly a constant and not a fitted value from someone else's analysis of another data set, for which you should be estimating a new value from your data set. That type of problem arose in the question I linked in the previous paragraph. If you do only have 1 free parameter, you could use the optim function instead of nls in R.
