Update link to journal and matlab scripts
This commit is contained in:
247
matlab/index.org
247
matlab/index.org
@@ -167,10 +167,10 @@ exportFig('figs/weight_formula.pdf', 'width', 'wide', 'height', 'normal');
|
||||
[[file:figs/weight_formula.png]]
|
||||
|
||||
#+begin_src matlab
|
||||
n = 2; w0 = 2*pi*10; G0 = 1/10; G1 = 1000; Gc = 0.45;
|
||||
n = 3; w0 = 2*pi*10; G0 = 1000; G1 = 0.1; Gc = 0.45;
|
||||
W1 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
|
||||
|
||||
n = 3; w0 = 2*pi*10; G0 = 1000; G1 = 0.1; Gc = 0.45;
|
||||
n = 2; w0 = 2*pi*10; G0 = 1/10; G1 = 1000; Gc = 0.45;
|
||||
W2 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
|
||||
#+end_src
|
||||
|
||||
@@ -249,6 +249,28 @@ H1 = 1 - H2;
|
||||
** Obtained Complementary Filters
|
||||
The obtained complementary filters are shown on figure [[fig:hinf_filters_results]].
|
||||
|
||||
#+begin_src matlab :results output replace :exports results :tangle no
|
||||
zpk(H1)
|
||||
zpk(H2)
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_example
|
||||
zpk(H1)
|
||||
ans =
|
||||
|
||||
(s+1.289e05) (s+153.6) (s+3.842)^3
|
||||
-------------------------------------------------------
|
||||
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
|
||||
|
||||
zpk(H2)
|
||||
ans =
|
||||
|
||||
125.61 (s+3358)^2 (s^2 + 46.61s + 813.8)
|
||||
-------------------------------------------------------
|
||||
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
|
||||
#+end_example
|
||||
|
||||
#+begin_src matlab :exports none
|
||||
figure;
|
||||
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
||||
@@ -1315,45 +1337,67 @@ exportFig('figs/hinf_comp_H1_H2_syn.pdf', 'width', 'wide', 'height', 'normal');
|
||||
[[file:figs/hinf_comp_H1_H2_syn.png]]
|
||||
|
||||
** Using Feedback architecture
|
||||
|
||||
#+begin_src matlab
|
||||
n = 2; w0 = 2*pi*11; G0 = 1/10; G1 = 1000; Gc = 1/2;
|
||||
n = 3; w0 = 2*pi*10; G0 = 1000; G1 = 0.1; Gc = 0.45;
|
||||
W1 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
|
||||
|
||||
n = 3; w0 = 2*pi*10; G0 = 1000; G1 = 0.1; Gc = 1/2;
|
||||
n = 2; w0 = 2*pi*10; G0 = 1/10; G1 = 1000; Gc = 0.45;
|
||||
W2 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
|
||||
#+end_src
|
||||
|
||||
Let's first synthesize $H_1(s)$:
|
||||
#+begin_src matlab
|
||||
P = [W1 -W1;
|
||||
0 W2;
|
||||
1 -1];
|
||||
P = [ W1 0 1;
|
||||
-W1 W2 -1];
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab :results output replace :exports both
|
||||
[K, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'lmi', 'DISPLAY', 'on');
|
||||
[L, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'lmi', 'DISPLAY', 'on');
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
H1 = inv(1 + K);
|
||||
H1 = inv(1 + L);
|
||||
H2 = 1 - H1;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab :results output replace :exports results :tangle no
|
||||
zpk(H1)
|
||||
zpk(H2)
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
#+begin_example
|
||||
zpk(H1)
|
||||
ans =
|
||||
|
||||
(s+2.115e07) (s+153.6) (s+4.613) (s^2 + 6.858s + 12.03)
|
||||
--------------------------------------------------------
|
||||
(s+2.117e07) (s^2 + 102.1s + 2732) (s^2 + 69.43s + 3271)
|
||||
|
||||
zpk(H2)
|
||||
ans =
|
||||
|
||||
20455 (s+3425) (s+3318) (s^2 + 46.58s + 813.2)
|
||||
--------------------------------------------------------
|
||||
(s+2.117e07) (s^2 + 102.1s + 2732) (s^2 + 69.43s + 3271)
|
||||
#+end_example
|
||||
|
||||
#+begin_src matlab :exports none
|
||||
freqs = logspace(-2, 4, 1000);
|
||||
|
||||
figure;
|
||||
hold on;
|
||||
plot(freqs, abs(squeeze(freqresp(H1, freqs, 'Hz'))), '-', 'DisplayName', '$H_1$');
|
||||
plot(freqs, abs(squeeze(freqresp(H2, freqs, 'Hz'))), '-', 'DisplayName', '$H_2$');
|
||||
set(gca,'ColorOrderIndex',1);
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$|W_1|^{-1}$');
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$|W_2|^{-1}$');
|
||||
set(gca,'ColorOrderIndex',1);
|
||||
plot(freqs, abs(squeeze(freqresp(H1, freqs, 'Hz'))), '-', 'DisplayName', '$|H_1|$');
|
||||
plot(freqs, abs(squeeze(freqresp(H2, freqs, 'Hz'))), '-', 'DisplayName', '$|H_2|$');
|
||||
plot(freqs, abs(squeeze(freqresp(L, freqs, 'Hz'))), 'k--', 'DisplayName', '$|L|$');
|
||||
hold off;
|
||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
||||
xlabel('Frequency [Hz]'); ylabel('Magnitude');
|
||||
legend('location', 'northeast', 'FontSize', 8, 'NumColumns', 2);
|
||||
legend('location', 'northeast', 'FontSize', 8, 'NumColumns', 3);
|
||||
#+end_src
|
||||
|
||||
** Adding feature in the filters
|
||||
@@ -1999,6 +2043,183 @@ There is no difference between " open-loop" shaping and "close-loop" shaping:
|
||||
- same obtained filter orders
|
||||
#+end_important
|
||||
|
||||
** Integral Action
|
||||
*** Test
|
||||
#+begin_src matlab
|
||||
freqs = logspace(-2, 3, 1000);
|
||||
#+end_src
|
||||
|
||||
\begin{equation}
|
||||
W_1(s) = \frac{W_{10}(s)}{s}
|
||||
\end{equation}
|
||||
with $W_{10}(0) \neq 0$
|
||||
|
||||
#+begin_src matlab
|
||||
W10 = 0.1*(s+125.7)^2/(s+1.257)^2*(s + 0.0001)/(1 + s/1000);
|
||||
W1 = W10/s;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
n = 2; w0 = 2*pi*10; G0 = 1/10; G1 = 1000; Gc = 0.5;
|
||||
W2 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab :exports none
|
||||
figure;
|
||||
hold on;
|
||||
set(gca,'ColorOrderIndex',1)
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$|W_1|^{-1}$');
|
||||
set(gca,'ColorOrderIndex',2)
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$|W_2|^{-1}$');
|
||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
||||
xlabel('Frequency [Hz]'); ylabel('Magnitude');
|
||||
hold off;
|
||||
xlim([freqs(1), freqs(end)]);
|
||||
ylim([1e-4, 20]);
|
||||
xticks([0.1, 1, 10, 100, 1000]);
|
||||
leg = legend('location', 'southeast', 'FontSize', 8);
|
||||
leg.ItemTokenSize(1) = 18;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
V = 1;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
P = [ V*W10 W10;
|
||||
0 W2;
|
||||
-V -1];
|
||||
#+end_src
|
||||
|
||||
And we do the $\mathcal{H}_\infty$ synthesis using the =hinfsyn= command.
|
||||
#+begin_src matlab :results output replace :exports both
|
||||
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'lmi', 'DISPLAY', 'on');
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
H1 = 1 - H2;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab :exports none
|
||||
figure;
|
||||
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
||||
|
||||
% Magnitude
|
||||
ax1 = nexttile([2, 1]);
|
||||
hold on;
|
||||
set(gca,'ColorOrderIndex',1)
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$w_1$');
|
||||
set(gca,'ColorOrderIndex',2)
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$w_2$');
|
||||
|
||||
set(gca,'ColorOrderIndex',1)
|
||||
plot(freqs, abs(squeeze(freqresp(H1, freqs, 'Hz'))), '-', 'DisplayName', '$H_1$');
|
||||
set(gca,'ColorOrderIndex',2)
|
||||
plot(freqs, abs(squeeze(freqresp(H2, freqs, 'Hz'))), '-', 'DisplayName', '$H_2$');
|
||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
||||
hold off;
|
||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
||||
ylabel('Magnitude');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
ylim([1e-4, 20]);
|
||||
yticks([1e-4, 1e-3, 1e-2, 1e-1, 1, 1e1]);
|
||||
leg = legend('location', 'southeast', 'FontSize', 8, 'NumColumns', 2);
|
||||
leg.ItemTokenSize(1) = 18;
|
||||
|
||||
% Phase
|
||||
ax2 = nexttile;
|
||||
hold on;
|
||||
set(gca,'ColorOrderIndex',1)
|
||||
plot(freqs, 180/pi*phase(squeeze(freqresp(H1, freqs, 'Hz'))), '-');
|
||||
set(gca,'ColorOrderIndex',2)
|
||||
plot(freqs, 180/pi*phase(squeeze(freqresp(H2, freqs, 'Hz'))), '-');
|
||||
hold off;
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
set(gca, 'XScale', 'log');
|
||||
yticks([-180:90:180]);
|
||||
|
||||
linkaxes([ax1,ax2],'x');
|
||||
xlim([freqs(1), freqs(end)]);
|
||||
#+end_src
|
||||
|
||||
*** Example 6.7.3
|
||||
#+begin_src matlab
|
||||
n = 2; w0 = 2*pi*10; G0 = 1000; G1 = 0.1; Gc = 0.45;
|
||||
W1 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
|
||||
|
||||
n = 2; w0 = 2*pi*10; G0 = 1/10; G1 = 1000; Gc = 0.45;
|
||||
W2 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
V = 1/(1 + s/2/pi/100);
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
V = W2;
|
||||
W2 = tf(1);
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
P = [W1 -W1;
|
||||
0 W2;
|
||||
V 0];
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab :results output replace :exports both
|
||||
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
H2 = H2*V;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab
|
||||
H1 = 1 - H2;
|
||||
#+end_src
|
||||
|
||||
#+begin_src matlab :exports none
|
||||
figure;
|
||||
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
|
||||
|
||||
% Magnitude
|
||||
ax1 = nexttile([2, 1]);
|
||||
hold on;
|
||||
set(gca,'ColorOrderIndex',1)
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$w_1$');
|
||||
set(gca,'ColorOrderIndex',2)
|
||||
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$w_2$');
|
||||
|
||||
set(gca,'ColorOrderIndex',1)
|
||||
plot(freqs, abs(squeeze(freqresp(H1, freqs, 'Hz'))), '-', 'DisplayName', '$H_1$');
|
||||
set(gca,'ColorOrderIndex',2)
|
||||
plot(freqs, abs(squeeze(freqresp(H2, freqs, 'Hz'))), '-', 'DisplayName', '$H_2$');
|
||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
||||
hold off;
|
||||
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
|
||||
ylabel('Magnitude');
|
||||
set(gca, 'XTickLabel',[]);
|
||||
ylim([1e-4, 20]);
|
||||
yticks([1e-4, 1e-3, 1e-2, 1e-1, 1, 1e1]);
|
||||
leg = legend('location', 'southeast', 'FontSize', 8, 'NumColumns', 2);
|
||||
leg.ItemTokenSize(1) = 18;
|
||||
|
||||
% Phase
|
||||
ax2 = nexttile;
|
||||
hold on;
|
||||
set(gca,'ColorOrderIndex',1)
|
||||
plot(freqs, 180/pi*phase(squeeze(freqresp(H1, freqs, 'Hz'))), '-');
|
||||
set(gca,'ColorOrderIndex',2)
|
||||
plot(freqs, 180/pi*phase(squeeze(freqresp(H2, freqs, 'Hz'))), '-');
|
||||
hold off;
|
||||
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
|
||||
set(gca, 'XScale', 'log');
|
||||
yticks([-180:90:180]);
|
||||
|
||||
linkaxes([ax1,ax2],'x');
|
||||
xlim([freqs(1), freqs(end)]);
|
||||
#+end_src
|
||||
|
||||
* Impose a positive slope at DC or a negative slope at infinite frequency
|
||||
** Introduction :ignore:
|
||||
|
||||
|
Reference in New Issue
Block a user