Commit 4be07b6d authored by Kristian Soltesz's avatar Kristian Soltesz
Browse files

Completed example

parent bffc055b
...@@ -6,12 +6,11 @@ ...@@ -6,12 +6,11 @@
%% Setup %% Setup
clear all clear all
close all
clc clc
% Process model (continuous time LTI SISO system) % Process model (continuous time LTI SISO system)
s = zpk('s'); s = zpk('s');
P = 1/(s^2+2*.7*s+1)*exp(-0.5*s); P = 1/(s^2+2*.5*s+1)*exp(-0.5*s);
% Robustness consraints % Robustness consraints
Ms = 1.6; % Maximum allowed sensitivity function magnitude Ms = 1.6; % Maximum allowed sensitivity function magnitude
...@@ -41,14 +40,17 @@ L = @(K)series(P,K); ...@@ -41,14 +40,17 @@ L = @(K)series(P,K);
S = @(K)feedback(1,L(K)); S = @(K)feedback(1,L(K));
T = @(K)feedback(L(K),1); T = @(K)feedback(L(K),1);
KS = @(K)feedback(K,P); KS = @(K)feedback(K,P);
PS = @(K)feedback(P,K)
% Bode magnitudes (to verify robustness constraints) % Bode magnitudes (to verify robustness constraints)
wMin = w(1); wMin = w(1);
wMax = w(end); wMax = w(end);
close all
figure(1) figure(1)
subplot(311) subplot(311)
bodemag(S(K1),{wMin,wMax},'b',S(K2),'r--',S(K3),'g') bodemag(S(K1),{wMin,wMax},'b',S(K2),'r',S(K3),'g')
hold on hold on
ylim([1e-1 2*Ms]) ylim([1e-1 2*Ms])
set(gca,'ytick',[1 Ms]) set(gca,'ytick',[1 Ms])
...@@ -58,7 +60,7 @@ legend('IE-optimal','IAE-optimal','IAE-optimal w. filter','Constraint',... ...@@ -58,7 +60,7 @@ legend('IE-optimal','IAE-optimal','IAE-optimal w. filter','Constraint',...
'Location','NorthWest') 'Location','NorthWest')
subplot(312) subplot(312)
bodemag(T(K1),{wMin,wMax},'b',T(K2),'r--',T(K3),'g') bodemag(T(K1),{wMin,wMax},'b',T(K2),'r',T(K3),'g')
hold on hold on
ylim([1e-1 2*Mt]) ylim([1e-1 2*Mt])
set(gca,'ytick',[1 Mt]) set(gca,'ytick',[1 Mt])
...@@ -66,7 +68,7 @@ plot([wMin wMax],Mt*[1 1],'k') ...@@ -66,7 +68,7 @@ plot([wMin wMax],Mt*[1 1],'k')
title('Complementary sensitivity') title('Complementary sensitivity')
subplot(313) subplot(313)
bodemag(KS(K1),{wMin,wMax},'b',KS(K2),'r--',KS(K3),'g') bodemag(KS(K1),{wMin,wMax},'b',KS(K2),'r',KS(K3),'g')
hold on hold on
ylim([1e-1 2*Mks]) ylim([1e-1 2*Mks])
set(gca,'ytick',[1 Mks]) set(gca,'ytick',[1 Mks])
...@@ -74,8 +76,13 @@ plot([wMin wMax],Mks*[1 1],'k') ...@@ -74,8 +76,13 @@ plot([wMin wMax],Mks*[1 1],'k')
title('Noise sensitivity') title('Noise sensitivity')
% Load disturbance response (to compute IE and IAE) % Load disturbance response (to compute IE and IAE)
%figure(2) figure(2)
% FIXME: plot temporal responses step(PS(K1),'b',PS(K2),'r',PS(K3),'g',P,'k')
hold on
title('Load step response')
legend('IE-optimal','IAE-optimal','IAE-optimal w. filter','Open-loop',...
'Location','East')
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment