Questions 1-2
Questions 1-2
RECALL:
Constructing a transfer function in Scilab:
• Use poly to create a symbolic variable for s.
• Use syslin to obtain a continuous-time system.
Solution:
subplot(2, 1, 1);
plot(t, y);
title("Step Response of the Plant – Open Loop");
xlabel("Time (s)");
ylabel("Amplitude");
Question 1:Compare open loop and closed loop
systems using SCILAB.
Solution: CLOSED LOOP
y2 = csim(u, t, T);
subplot(2, 1, 2);
plot(t, y2);
title("Step Response of the Plant – Closed Loop");
xlabel("Time (s)");
ylabel("Amplitude");
Question 2:Study transient response for a given system
using SCILAB.
Solution:
s = poly(0, 's');
// Define the damping ratio
zeta1 = 0.9;
zeta2 = 6;
zeta3 = 20;
// Define the transfer functions for each case
H1 = 1 / (s^2 + 2*zeta1*s + 36);
H2 = 1 / (s^2 + 2*zeta2*s + 36);
H3 = 1 / (s^2 + 2*zeta3*s + 36);
Question 2:Study transient response for a given system
using SCILAB.
// Create the continuous-time systems
sys1 = syslin('c', H1);
sys2 = syslin('c', H2);
sys3 = syslin('c', H3);
// Define the time vector (0 to 20 seconds)
t = 0:0.1:20;
// Define the step input (vector of ones)
u = ones(t);
// Simulate the responses of each system
y1 = csim(u, t, sys1);
y2 = csim(u, t, sys2);
y3 = csim(u, t, sys3);
Question 2:Study transient response for a given system
using SCILAB.
// Plot the responses
plot(t, y1, 'r', t, y2, 'g', t, y3, 'b');
legend('z1', 'z2', 'z3');
xlabel('Time (s)');
ylabel('Output');
title('Step Response for a Second-Order System');