From: "Toan Cao" <>
Newsgroups: comp.soft-sys.matlab
Subject: computation time of function lsqnonlin
Date: Fri, 13 Sep 2013 03:38:06 +0000 (UTC)
Organization: &#50872;&#49328;&#45824;&#54617;&#44368;
Lines: 8
Message-ID: <l0u1au$ei4$>
Reply-To: "Toan Cao" <>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1379043486 14916 (13 Sep 2013 03:38:06 GMT)
NNTP-Posting-Date: Fri, 13 Sep 2013 03:38:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2244433
Xref: comp.soft-sys.matlab:802337

I write an objective function in both m-file (fileA1.m) and C mex file (fileA2.c). Given an input to this objective function, computation time in C mex file is 15 times faster than that of m- file.  However, when i use the objective function in function lsqnonlin of Matlab, computation time which lsqnonlin gets a optimal solution is almost the same for both files (~101 minutes for C mex file and ~104 minutes for m-file).
I hope when i use C mex file, i will save more time for optimization process, but it is not.
Can you help me explain why  lsqnonlin spends almost the same computation time?
I would like to understand more how lsqnonlin of Matlab works to reduce its time?
Thanks in advance!