wcgain function for uncertain real plant
9 次查看(过去 30 天)
显示 更早的评论
I have some problem in using wcgain function for uncertain real plant (uss system).
My code is like below.
There are three ureal parameters a0, b0, and urealtau.
In the case when I use only a0 and b0 to define the uss system Tyd, the function wcgain works well.
However, if I use all three ureal parameters a0, b0 and urealtau to define the uss system urealTyd,
the function wcgain doesn't work and the error message says that
the system urealTyd (which is defined by all ureal parameters) becomes a dss(descriptor state-space) model.
The error message seems to be wrong since the system urealTyd is just a combination of conventional linear systems (even though the linear system contains some uncertain parameters).
I think the problem is that wcgain doesn't work for the systems that contain some nonlinear combinations of ureal parameters (e.g., multiplication between ureal parameters), but I'm still wondering why this kind of problem occurs.
Thank you for your help.
C = tf(2, [1, 4]);
Pn = tf(5, [1, -2]);
a0 = ureal('a0', -2, 'Range', [-10, 10]);
b0 = ureal('b0', 5, 'Range', [4, 10]);
tau = 0.04
Q = tf(1, [tau, 1]);
P= tf(b0, [1, a0]);
Tyd = feedback(P, series(parallel(C, Q/Pn), feedback(1, -Q)));
wcgain(Tyd)
urealtau = ureal('tau', 0.0002, 'Range', [0, 0.001]);
urealQ = tf(1, [urealtau, 1]);
urealTyd = feedback(P, series(parallel(C, urealQ/Pn), feedback(1, -urealQ)));
wcgain(urealTyd)
0 个评论
回答(1 个)
Abhimenyu
2024-11-8,4:34
编辑:Abhimenyu
2024-11-8,4:36
Hi Hamin,
I understand that you are encountering an issue related to how MATLAB handles uncertain systems with nonlinear parameter combinations. The problem arises because when you introduce urealtau in the feedback loop, rational expressions are created involving uncertain parameters. This leads to a more complex system representation that MATLAB converts to a descriptor state-space (DSS) model.
The wcgain function is designed primarily for uncertain systems with affine parameter dependencies. When you have products or ratios of uncertain parameters, the system becomes non-affine, which can cause issues with wcgain.
When the system has nonlinear combinations of uncertain parameters (like urealtau), gridded analysis can handle these nonlinear relationships by evaluating the system at discrete points. It samples the parameter space at discrete points, computes the system response at each point and then finds the approximate worst-case gain.
Please find the example MATLAB code below that will help you with the gridded analysis:
% Define nominal parameters
a0_nom = -2;
b0_nom = 5;
tau_nom = 0.0002;
This creates a 3D grid with 5×5×5 = 125 total points to evaluate.
% Create parameter grid (using fewer points for initial testing)
n_points = 5;
a0_range = linspace(-10, 10, n_points);
b0_range = linspace(4, 10, n_points);
tau_range = linspace(0.0001, 0.001, n_points); % Avoid tau = 0
% Initialize arrays for worst-case gain
max_gain = 0;
worst_params = [a0_nom, b0_nom, tau_nom];
% Define constant transfer functions outside the loop
C = tf(2, [1, 4]);
Pn = tf(5, [1, -2]);
At each grid point, this loop creates transfer functions using the current parameter values. The minreal() function helps prevent numerical issues by simplifying transfer functions as given by this MATLAB documentation:
% Analyze system over parameter grid
for i = 1:n_points
for j = 1:n_points
for k = 1:n_points
% Create transfer functions with current parameter values
P = tf(b0_range(j), [1, a0_range(i)]);
Q = tf(1, [tau_range(k), 1]);
% Build the system step by step
% 1. Inner feedback loop
inner_fb = feedback(1, -Q);
% 2. Parallel connection
parallel_sys = parallel(C, minreal(Q/Pn));
% 3. Series with inner feedback
series_sys = series(parallel_sys, inner_fb);
series_sys = minreal(series_sys);
% 4. Outer feedback loop
Tyd = feedback(P, series_sys);
Tyd = minreal(Tyd);
% Compute infinity norm
[gain, ~] = norm(Tyd, inf);
if ~isnan(gain) && ~isinf(gain) && gain > max_gain
max_gain = gain;
worst_params = [a0_range(i), b0_range(j), tau_range(k)];
end
end
end
end
% Display results
fprintf('\nAnalysis Results:\n');
fprintf('Approximate worst-case gain: %f\n', max_gain);
fprintf('Worst-case parameters:\n');
fprintf('a0 = %f\nb0 = %f\ntau = %f\n', worst_params(1), worst_params(2), worst_params(3));
The analysis given above helps to calculate system gain at current point, updates max_gain and worst_params if this point has higher gain and checks for valid gains (not NaN or Inf).
I hope this helps!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Uncertain Models 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!