Hi Smit,
I just added support for the nonlinear least square cost in Matlab for the templates on the master branch.
Let me know, if it works for you.
Best, Jonathan