I am triying to fit a NLARX model using MATLAB 2024a but for some reason the fit is poor, but I have used the same code with MATLAB 2023b and the fit is good.

5 views (last 30 days)
I am using the LM estimation method and the estimation dataset is the same. The only difference is that for the MATLAB 2024 the fitting is very bad, but for MATLAB 2023b it is okay. It is very strange. I have test also the same code in differnet computers and the behavior is the same. The erros seems to happen in the 2024a version of the nlarx function.
What can I do ?
  2 Comments
Erick Axel
Erick Axel on 27 Aug 2024
I am attaching a mat file with the data and also the discrete linear model that i am using to initilize the nlarx model.
Below is the code I am using.
%%
NumberOfUnits = 1;
NonlinearFcn = idSigmoidNetwork(1,true,true);
nlarxopt = nlarxOptions(Focus="simulation");
nlarxopt.SearchMethod = 'lm';
nlarxopt.SearchOptions.MaxIterations = 5;
nlarxopt.Display = 'on';
%%
Net = nlarx(tData,linsys_d,NonlinearFcn,nlarxopt)
Hope it helps. I attached a capture of the behavior i get from matlab 2023b. For MATLAB 2024 the fit is very bad using the same configuration.

Sign in to comment.

Answers (1)

Animesh
Animesh on 29 Aug 2024
In MATLAB R2024a release, the linear model specified in the Nonlinear ARX model is preserved as-is during the model coefficient initialization stage. In contrast, previous releases modified the specified linear model beforehand to minimize the 1-step prediction errors.
In this situation, the provided linear model does not offer a good initial guess for the linear component of the Nonlinear ARX model. It worked in previous releases because the linear model was adjusted beforehand. Allowing the algorithm to select a better linear model can improve its quality.
Here’s something you can try:
Instead of using the linear model ("linsys_d"), use an ARX-order matrix that matches its order:
na = eye(2) * 4;
nb = ones(2, 10) * 4;
nk = ones(2, 10);
Order = [na nb nk];
Net = nlarx(data.tData, Order, NonlinearFcn, nlarxopt);
This approach gives the NLARX algorithm full freedom to choose the coefficients of the linear component (`Net.OutputFcn(i).LinearFcn` for `i=1,2`).
This is also how the MATLAB R2023a version operates. The specified linear model is not retained as the starting point for simulation-error minimization; instead, it is modified beforehand to provide the optimizer with a good starting point.
Hope this resolves your query.

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!