How to initialize the Hammerstein model linear block and avoiding that the nlhw function transform the linear block to polynomial form ?

40 次查看(过去 30 天)
Hi.
I am trying to estiamte a Hammerstein Model. I have a state representation of the linear block to generate the Hammerstein model, however for some reason the idnlhw function convert the state representation that I have to polynomial form. The above should not be a problem, but the poles of linear block are close together due to the slow dynamcis of my system. From what i read in this post https://la.mathworks.com/help/control/ug/sensitivity-of-multiple-roots.html closelied space poles are very sensitivy to model transformaiton from state space to polynomial represntation.
The above becomes problematic because I want to program this model in a 32-bit microncontroller but this pole sensitivy changes the value of my poles when I convert them to single precision.
How can I solve this issue.

回答(1 个)

Rahul
Rahul 2024-9-17,11:21
Hi,
While using the “idnlhw” function to construct a Hammerstein-Weiner model object, a state-space linear model is probably implicitly converted to a transfer function, which causes the closely spaced poles to be altered by small margins, enough to cause instability in the system.
Although, this behavior cannot be altered due to floating point errors and storage, but you can try the below mentioned possible workaround:
  • Specify Precision: Use double data type precision while defining state space matrices for the linear model before calling the ”idnlhw” function.
  • Transfer Function: Instead of using “ss” function to construct the linear model as a state-space, you can use “ss2tf” function to create transfer function numerator and denominator polynomials for the model beforehand, create a transfer function using “tf” function and the obtained polynomials, and finally pass it to the ”idnlhw” function to create the Hammerstein model.Unlike using “ss” or “tf” functions, ”ss2tf” more accurately retains the transfer function coefficients of models with closely related poles or zerosand doesn’t enforce pole-zero cancellation as much. Thus, retaining most of the poles/zeros as obtained from the original state-space matrices.
The following code is an example of how you can achieve the same in MATLAB:
% Define state-space matrices for a discrete-time system
A = double([0.9 0.1;0 0.90001]);
B = double([1; 0]);
C = double([1 1]);
D = double(0);
% Create state-space system
sys_ss = idss(A, B, C, D);
% Convert state space to transfer function
[num, den] = ss2tf(A, B, C, D);
convsys_tf = tf(num, den, 1)
convsys_tf = z - 0.9 ------------------ z^2 - 1.8 z + 0.81 Sample time: 1 seconds Discrete-time transfer function.
% Display poles and zeros of state space linear model
disp('Poles of State-Space System:');
Poles of State-Space System:
disp(pole(sys_ss));
0.9000 0.9000
disp('Zeros:');
Zeros:
disp(zero(sys_ss));
0.9000
% Display poles and zeros of converted transfer function of linear model
disp('Poles of Converted Transfer Function System:');
Poles of Converted Transfer Function System:
disp(pole(convsys_tf));
0.9000 0.9000
disp('Zeros:');
Zeros:
disp(zero(convsys_tf));
0.9000
% Simulate the response
t = 0:1:100; % Time vector
u = ones(size(t)); % Input signal (step input)
[y1, t1, x1] = lsim(sys_ss, u, t);
[y2, t2, x2] = lsim(convsys_tf, u, t);
% Plot the response
figure;
plot(t1, y1);
hold on;
plot(t2, y2);
hold off;
xlabel('Time (s)');
ylabel('Output');
title('Response of the Discrete-Time System');
legend on
legend({'State Space Model', 'Converted transfer function'});
% Check Linear Models of idnlhw objects
hw_ss = idnlhw(sys_ss);
mdl_ss = hw_ss.LinearModel
mdl_ss = Discrete-time OE model: y(t) = [B(z)/F(z)]u(t) + e(t) B(z) = z^-1 F(z) = 1 - 0.9 z^-1 Sample time: 1 seconds Parameterization: Polynomial orders: nb=1 nf=1 nk=1 Number of free coefficients: 2 Use "polydata", "getpvec", "getcov" for parameters and their uncertainties. Status: Extracted from an IDNLHW model
hw_tf = idnlhw(convsys_tf);
mds_tf = hw_tf.LinearModel
mds_tf = Discrete-time OE model: y(t) = [B(z)/F(z)]u(t) + e(t) B(z) = z^-1 - 0.9 z^-2 F(z) = 1 - 1.8 z^-1 + 0.81 z^-2 Sample time: 1 seconds Parameterization: Polynomial orders: nb=2 nf=2 nk=1 Number of free coefficients: 4 Use "polydata", "getpvec", "getcov" for parameters and their uncertainties. Status: Extracted from an IDNLHW model
For more information regarding usage of "ss2tf" function to generate transfer function polynomials in MATLAB, refer to the documentation link mentioned below:

类别

Help CenterFile Exchange 中查找有关 Linear Model Identification 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by