How do I avoid getting an Estimation Error dialog box when attempting to use the 4 cores of my computer to estimate the parameters of a Simulink model by using the Control and Estimation Tools Manager GUI?
The error happens 7-8 minutes after the first "Measured vs Simulated" plot is shown. The error message in the dialog box is the following:
Error stack:
findParametersWS.m at 39
assignin.m at 16
error.m at 16
numjacobian>LocalWrapError at 92
numjacobian>(parfor body) at 47
Failure in initial user-supplied objective function evaluation.
LSQNONLIN cannot continue.
The estimation works fine when using one core. Changing "Nonlinear least squares" to "Gradient Descent" just changes "LSQNONLIN" in the message. I also tried adding my current folder to the Model Path Dependencies in the Manager but it did not work.
My setup is as follows. The parameter estimation is for a single Simulink model. The simulation is in Accelerator mode. Before opening the Control and Estimation Tools Manager, I manually run a script to load the parameters to estimate. The model has under Callbacks-InitFcn two scripts for loading fixed parameters and signals (different from the inputs used by the Manager). The 3 scripts are in the same folder as the .mdl file. I manually open four labs with matlabpool and select parallel computing in the Manager. The error happens some time after the aforementioned plot is shown and no optimization iteration is performed.
I already looked in Internet for the error but I was unable to find useful information. I will really appreciate any information that can help me solve this problem.