consider the unity feedback system shown in figure 1, where g(s) = 12 s 2 +2s+10 . using matlab or simulink determine (a) the step response. (b) the percentage overshoot. (c) the steady-state error in matlab

To determine the step response, percentage overshoot, and steady-state error of the given unity feedback system in MATLAB, we first need to create the transfer function using the numerator and denominator coefficients.

main.m
num = [0 0 12 2 10];
den = [1 0 0 0 0];
sys_tf = tf(num, den);
63 chars
4 lines

This creates a transfer function object sys_tf for our system.

Step Response

To find the step response of the system using MATLAB, we can use the step function and pass in the transfer function object.

main.m
step(sys_tf);
14 chars
2 lines

This will generate the step response plot for the given system.

Percentage Overshoot

To find the percentage overshoot in MATLAB, we can use the stepinfo function and pass in the transfer function object.

main.m
step_info = stepinfo(sys_tf);
percent_overshoot = step_info.Overshoot;
71 chars
3 lines

This will calculate and store the percentage overshoot of the system in the variable percent_overshoot.

Steady-State Error

To find the steady-state error of the system in MATLAB, we can use the step function and pass in a step function with a final value of 1.0. We can then use the stepinfo function to extract the steady-state error from the RiseTime and SettlingTime fields of the output structure.

main.m
t = 0:0.01:10; % Time vector up to t=10 seconds
u = ones(size(t)); % Step input vector

% Simulating the system with step input
y = lsim(sys_tf,u,t);

% Extracting steady state error
ss_error = 1 - y(end);
206 chars
9 lines

This code will simulate the system with the step input, and calculate the steady-state error by subtracting the final value of the output after the step has settled from the expected value of 1.0.

Overall code capturing all of the above steps:

main.m
num = [0 0 12 2 10];
den = [1 0 0 0 0];
sys_tf = tf(num, den);

step(sys_tf); % Step response

step_info = stepinfo(sys_tf);
percent_overshoot = step_info.Overshoot; % Percentage overshoot

t = 0:0.01:10; % Time vector up to t=10 seconds
u = ones(size(t)); % Step input vector

% Simulating the system with step input
y = lsim(sys_tf,u,t);

% Extracting steady state error
ss_error = 1 - y(end); 
397 chars
18 lines

gistlibby LogSnag