From 316eb0e1dfabefc4cb61c2fba1b7ed64adfc57ca Mon Sep 17 00:00:00 2001 From: Enrico Lumetti Date: Wed, 11 Aug 2021 18:59:38 +0200 Subject: [PATCH] Example of multiplicative uncertainty fit --- robust/mult_uncertainty.m | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 robust/mult_uncertainty.m diff --git a/robust/mult_uncertainty.m b/robust/mult_uncertainty.m new file mode 100644 index 0000000..83e5e67 --- /dev/null +++ b/robust/mult_uncertainty.m @@ -0,0 +1,34 @@ +clear; + +s = tf('s'); + +k = ureal('k', 2.5, 'Range', [2, 3]); +tau = ureal('tau', 2.5, 'Range', [2, 3]); +theta = ureal('theta', 2.5, 'Range', [2, 3]); + +% delay is approximated using pade: +% e^(-theta*s) = e^(-theta*s)/2 1 - theta*s/2 +% ------------- = -------------- +% e^(theta*s)/2 1 + theta*s/2 + +G = k/(tau*s+1) * (1-theta*s)/2 / ((1+theta*s)/2); +G_nom = k.NominalValue/(tau.NominalValue*s+1); + +% G = (1+I_m)G_nom => I_m = (G-G_nom)/G_nom +I_m = (G-G_nom)/G_nom; + +% get wcgain +w = logspace(-3, 3, 40); +[wcg, wcu, info] = wcgain(I_m, w); + +% fit worst-case magnitude to obtain a closed form of the multiplicative +% uncertainty +data = frd(info.Bounds(:, 2), w); +% use a second-order model +I_m_analytic = tf(fitmagfrd(data, 2)); + +sigma(I_m, w); hold; +semilogx(w, 20*log10(info.Bounds(:, 2)), 'green'); +sigma(I_m_analytic, 'red'); + +I_m_analytic