Why are the number of linear model parameters calculated by MATLAB's nlarx inconsistent with the number of specified regressors?

8 次查看(过去 30 天)
Linear Function
Inputs: y1(t-1), y1(t-2), y1(t-3), u1(t), u1(t-1), u1(t-2), u1(t-3), sin(u1(t-1))
Output: y1(t)
Linear Function: initialized to [0.38 0.0429 -0.0307 -0.00106 0.000119 9.58e-07]
Output Offset: initialized to 4.39e-17
LinearFcn: 'Linear function parameters'
Offset: 'Offset parameters'
The calculation results show that my regressors specified 8 items, but the coefficients were only 6.

回答(1 个)

Ruchika Parag
Ruchika Parag 2025-7-2
Hi @Zitong, you're seeing fewer parameters in the LinearFcn because not all of your specified regressors are treated as part of the linear model component in the nlarx structure.
In your case, you've specified 8 regressors:
  • Three delayed outputs: y1(t-1), y1(t-2), y1(t-3)
  • Four delayed inputs: u1(t), u1(t-1), u1(t-2), u1(t-3)
  • One nonlinear regressor: sin(u1(t-1))
MATLAB’s nlarx model splits the regressors between linear and nonlinear components. The LinearFcn block only estimates parameters for regressors that are purely linear in form, such as lagged inputs and outputs. Nonlinear regressors—like sin(u1(t-1))—are not included in the LinearFcn parameter count. Instead, they are handled separately through the nonlinear function defined in the model's OutputFcn.Nonlinear block.
So when you see only 6 parameters in the LinearFcn, it likely means two of the eight regressors were either excluded (due to redundancy or model configuration) or are handled exclusively through the nonlinear pathway.
You can confirm this by inspecting:
model.OutputFcn.Linear.Parameters
model.OutputFcn.Nonlinear.Parameters
This behavior is by design. The total number of parameters reported in the linear function only reflects those regressors being used in the linear portion of the model. Nonlinear functions are evaluated and parameterized separately.
If you want to confirm which regressors are active in each part of the model, you can also use:
getreg(model)
Hope this helps!

标签

产品


版本

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by