Hi Harjot,
The model function fun requires two input arguments, a coefficient vector and an array X—in that order—and return a vector of fitted response values. As per the code snippet shared above, the co-efficient values have not been passed to the model function. For a good non-linear fit, it should be ensured that proper co-efficient values in the form of an array c has been passed to the model function.
Hope this helps!