I defined my method (method1) as a function file and stored it in a class folder. the method is functional and I don't have any problems using it.
Q =lsqnonlin(@method1, x0,lb,ub). I kept getting an error message:
Undefined function 'method1' for input arguments of type
the only way to overcome this error was to copy the method function and paste it into the current path even though it's already defined in the class folder.
after doing that the code was able to locate the function but now I had another issue, inside the method1 function I used dot notation often to get property values for calculations and I think it's not supported for functions in lsqnonlin. this is the error message I get:
Dot indexing is not supported for variables of this type.
Error in method1 (line 21)
Error in lsqnonlin (line 206)
Failure in initial objective function evaluation.
LSQNONLIN cannot continue.