Problem using the iv4() function, instrumental variable method

3 vues (au cours des 30 derniers jours)
Elouan
Elouan le 27 Juin 2024
Commenté : Umar le 27 Juin 2024
Hello,
I am currently working on a project aimed at identifying a simple system. The project is divided into several steps:
1. **Simulate a continuous system** such as an RLC circuit.
2. **Discretize the associated transfer function**.
3. **Obtain the time-domain output \( y \)** using the `lsim` function in MATLAB.
4. **Add Gaussian noise** to the output samples.
5. **Estimate the coefficients** of the discretized transfer function using the Instrumental Variable (IV) method.
I’m encountering an issue with the last step. Each time I rerun the code in MATLAB, the coefficients I obtain vary significantly. To understand this behavior, I performed a Monte Carlo test to estimate the standard deviation of the coefficients across multiple trials. The results show that this standard deviation is quite large.
Typically, the IV method should decorrelate the noise from the output, allowing for a stable estimation of the coefficients. Therefore, it's puzzling to observe such large variations between tests.
Here’s an excerpt of the code I am using:
%% Discretization Parameters
Ts = 0.01; % Sampling period
t = 0:Ts:10; % Time vector
%% Monte Carlo Loop for Multiple Realizations
num_realizations = 100; % Number of Monte Carlo realizations
p = tf('s'); % Laplace variable
for i = 1:num_realizations
% Generation of PRBS Signal
u = idinput(length(t), 'prbs', [0, 1/7]); % PRBS with 7 level changes
% Transfer Function of the Series RLC Circuit
FT_RLC_circuit = 1 / (L*C*p^2 + R*C*p + 1);
% System Simulation
Y_RLC_MC = lsim(FT_RLC_circuit, u, t);
% Adding Gaussian Noise with a Given SNR
SNR = 15;
e = randn(size(Y_RLC_MC));
k = sqrt( (Y_RLC_MC'*Y_RLC_MC) / (e'*e)) * 10^(-SNR/20);
b = k * e;
Y_noisy = Y_RLC_MC + b;
% Model Identification Using Instrumental Variable Method (IV4)
Sys = iv4(u, Y_noisy, [2 2 1]); % Chosen orders [na nb nk]
% Extracting Numerator and Denominator Coefficients
[num_iv, den_iv] = tfdata(Sys, 'v');
% Saving the Coefficients in a Structure or File
results(i).numerator = num_iv;
results(i).denominator = den_iv;
end
  1 commentaire
Umar
Umar le 27 Juin 2024

Hi Elouan,

To address the variability issue and ensure more stable coefficient estimation, we need to modify the way noise is added to the system. One potential solution is to calculate the noise amplification factor 'k' based on the noise added in a more controlled manner.

% Calculate noise amplification factor 'k' based on the added noise 'e'
    k = sqrt(SNR / var(e)) * 10^(-SNR/20);
    b = k * e;
    Y_noisy = Y_RLC_MC + b;

By recalculating the noise amplification factor 'k' based on the added noise 'e' in a consistent manner, we can reduce the variability in coefficient estimation across multiple Monte Carlo realizations. This modification should lead to more stable and reliable coefficient results.

Hope this will help resolve your issue.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Get Started with Control System Toolbox dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by