Sie sind auf Seite 1von 5

Second Order system

Equations
= =
+2 +
+ B
= = =
+ + A
T
u=
R
na = 2, nb = 1, d = na nb = 1, nr = nb + d 1 = 1, ns = na 1 = 1, = + + 1 = 3, n = 32
=1 =1
R = s+r ,S = s s+s ,T = t +
y BT ( + )(t + )
= =
u + ( + + )(s + r ) + ( + )(s + )
( + )(t + )
= =
( + + )(s + r ) + ( + )(s + )

= y


= y

= u

= u


= u


= y


= y

= u

= u


= u

Let = 0.7, = 1, = 2, = 1
Note: let there is a gain multiplied by the observer pole to have a model with unity dc gain | |

Code for output % Control Action


clc; close all;
h = figure(1);
sim('Second_Order_system');
plot(time, u(:, 2), 'LineWidth', 1.5);
time = err(:, 1);
grid on
xlabel('time') plot(time, ContParam(:, 2), 'LineWidth',
ylabel('Control Action (u)') 1.5);
title('Control Action (u) Vs Time') plot(time, ContParam(:, 3), 'LineWidth',
print(h,'-dpng','- 1.5);
r1000','Control_Action') plot(time, ContParam(:, 4), 'LineWidth',
1.5);
% Error plot(time, ContParam(:, 5), 'LineWidth',
h = figure(2); 1.5);
plot(time, err(:, 2), 'LineWidth', 1.5); plot(time, ContParam(:, 6), 'LineWidth',
grid on 1.5);
xlabel('time') grid on
ylabel('error = y - y_m') xlabel('time')
title('Error Between the Required Model ylabel('Control Parameters')
Output and the Actual Output') title('Control Parameters Vs Time')
print(h,'-dpng','-r1000','Error') legend('r_1', 's_0', 's_1', 't_0', 't_1')
print(h,'-dpng','-
% Output r1000','Control_Parameters')
h = figure(3);
hold all
plot(time, output(:, 2), 'LineWidth',
1.5);
plot(time, output(:, 3), 'LineWidth', Simulink Data
1.5); clc; close all; clear all;
plot(time, output(:, 4), 'LineWidth', global den;
1.5); global num;
grid on global gamma;
xlabel('time')
ylabel('Simulation Output') zeta = 0.7;
title('Simulation Output Vs Time') wn = 1;
legend('G_m Model Output', 'Adjusted obs = 2;
Output', 'Input (Required Output)')
print(h,'-dpng','-r1000','Output') Am = [1 2*zeta*wn wn^2];
A0 = [1 obs]
% Control Parameters
h = figure(4); den = conv(Am, A0);
hold all num = [wn^2*obs];
gamma = 1;

Das könnte Ihnen auch gefallen