0% found this document useful (0 votes)
13 views8 pages

Untitled 6

The document defines parameters for a DC motor system and analyzes its dynamic characteristics including poles, DC gain, damping ratio, natural frequency, zeros, settling time, rise time, percent overshoot, bode plot, impulse response, step response, and ramp response. The system parameters, eigenvalues, bode plot results, and responses to inputs are displayed.

Uploaded by

xigis95867
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views8 pages

Untitled 6

The document defines parameters for a DC motor system and analyzes its dynamic characteristics including poles, DC gain, damping ratio, natural frequency, zeros, settling time, rise time, percent overshoot, bode plot, impulse response, step response, and ramp response. The system parameters, eigenvalues, bode plot results, and responses to inputs are displayed.

Uploaded by

xigis95867
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

% DC motor parameters

J = 0.01; % Moment of inertia of rotor (kg.m^2)


b = 0.1; % Motor viscous friction constant (N.m.s)
Ke = 0.01; % EMF (V/rad/sec)
Kt = 0.01; % Motor torque constant (N.m/A)
R = 1; % Electric resistance (Ohm)
L = 0.5; % Electric inductance (H)

% System parameters
A = [0 1 0; 0 -b/J Kt/J; 0 -Ke/L -R/L];
B = [0; 0; 1/L];
C = [1 0 0];
D = 0;

% State-space
sys_ss = ss(A, B, C, D);

% Poles
poles_sys = eig(A);

% 1. DC Gain
DC_gain = C * inv(-A) * B + D;

Warning: Matrix is singular to working precision.

% 2. Damping Ratio, Natural Frequency


[num, den] = ss2tf(A, B, C, D);
damp_info = damp(tf(num, den));

% 3. Poles and Zeros


zeros_sys = tzero(sys_ss);

% 4. Settling Time, Rise Time, Percent Overshoot


step_info = stepinfo(sys_ss);

% 5. Bode plot
omega = logspace(-1, 2, 100);
[mag, phase] = bode(sys_ss, omega);

figure;
subplot(2, 1, 1);
semilogx(omega, 20*log10(mag(:)));
title('Bode Plot - Magnitude');
xlabel('Frequency (rad/sec)');
ylabel('Magnitude (dB)');
grid on;

subplot(2, 1, 2);
semilogx(omega, phase(:));

1
title('Bode Plot - Phase');
xlabel('Frequency (rad/sec)');
ylabel('Phase (degrees)');
grid on;

% 6. Impulse Response
t_impulse = 0:0.01:5;
impulse_response = impulse(sys_ss, t_impulse);
figure;
plot(t_impulse, impulse_response);
title('Impulse Response');
xlabel('Time (seconds)');
ylabel('Amplitude');
grid on;

2
% 7. Step Response
t_step = 0:0.01:5;
step_response = step(sys_ss, t_step);
figure;
plot(t_step, step_response);
title('Step Response');
xlabel('Time (seconds)');
ylabel('Amplitude');
grid on;

3
% 8. Ramp Response
t_ramp = 0:0.01:5;
ramp_response = lsim(sys_ss, t_ramp, t_ramp);
figure;
plot(t_ramp, ramp_response);
title('Ramp Response');
xlabel('Time (seconds)');
ylabel('Amplitude');
grid on;

4
% Display
disp('System Parameters:');

System Parameters:

disp(['A matrix:']);

A matrix:

disp(A);

0 1.0000 0
0 -10.0000 1.0000
0 -0.0200 -2.0000

disp(['B matrix:']);

B matrix:

disp(B);

0
0
2

disp(['C matrix:']);

5
C matrix:

disp(C);

1 0 0

disp(['D matrix:']);

D matrix:

disp(D);

disp(['Eigenvalues (Poles):']);

Eigenvalues (Poles):

disp(poles_sys);

0
-9.9975
-2.0025

% 1. DC Gain
disp(['\n1. DC Gain:']);

\n1. DC Gain:

disp(DC_gain);

NaN

% 2. Damping Ratio, Natural Frequency


disp(['\n2. Damping Ratio, Natural Frequency:']);

\n2. Damping Ratio, Natural Frequency:

disp(['Damping Ratio: ', num2str(damp_info(:, 1)')]);

Damping Ratio: 0 2.0025 9.9975

if size(damp_info, 2) > 1
disp(['Natural Frequency (rad/sec): ', num2str(damp_info(:, 2)')]);
else
disp('Natural Frequency information not available.');
end

Natural Frequency information not available.

% 3. Poles and Zeros


disp(['\n3. Poles and Zeros:']);

6
\n3. Poles and Zeros:

disp(['Poles: ', num2str(poles_sys')]);

Poles: 0 -9.9975 -2.0025

disp(['Zeros: ', num2str(zeros_sys')]);

Zeros:

% 4. Settling Time, Rise Time, Percent Overshoot


disp(['\n4. Settling Time, Rise Time, Percent Overshoot:']);

\n4. Settling Time, Rise Time, Percent Overshoot:

disp(['Settling Time (sec): ', num2str(step_info.SettlingTime)]);

Settling Time (sec): NaN

disp(['Rise Time (sec): ', num2str(step_info.RiseTime)]);

Rise Time (sec): NaN

disp(['Percent Overshoot (%): ', num2str(step_info.Overshoot)]);

Percent Overshoot (%): NaN

% 5. Bode plot
disp(['\n5. Bode Plot:']);

\n5. Bode Plot:

disp(['Frequency (rad/sec): ', num2str(omega)]);

Frequency (rad/sec): 0.1 0.1072267 0.1149757 0.1232847 0.1321941 0.1417474 0.1519911 0.1

% Display magnitude and phas


disp(['Magnitude (dB): ', num2str(20*log10(mag(:))')]);

Magnitude (dB): -0.01993282 -0.6276761 -1.235671 -1.843954 -2.452568 -3.061564 -3.670996

disp(['Phase (degrees): ', num2str(phase(:)')]);

Phase (degrees): -93.43192 -93.67955 -93.94499 -94.2295 -94.53443 -94.86124 -95.21146 -

% 6. Impulse Response
disp(['\n6. Impulse Response:']);

\n6. Impulse Response:

disp(['Time (sec): ', num2str(t_impulse)]);

Time (sec): 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08

7
disp(['Amplitude: ', num2str(impulse_response')]);

Amplitude: 0 9.6101e-05 0.00036959 0.00079989 0.0013685 0.0020586 0.0028552 0.0037448 0.0047152 0.005

% 7. Step Response
disp(['\n7. Step Response:']);

\n7. Step Response:

disp(['Time (sec): ', num2str(t_step)]);

Time (sec): 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08

disp(['Amplitude: ', num2str(step_response')]);

Amplitude: 0 3.2354e-07 2.5131e-06 8.2378e-06 1.8972e-05 3.6012e-05 6.0498e-05 9.3426e-05 0.00013566 0.0001

% 8. Ramp Response
disp(['\n8. Ramp Response:']);

\n8. Ramp Response:

disp(['Time (sec): ', num2str(t_ramp)]);

Time (sec): 0 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08

disp(['Amplitude: ', num2str(ramp_response')]);

Amplitude: 0 8.1367e-10 1.2715e-08 6.2881e-08 1.9419e-07 4.6335e-07 9.3926e-07 1.7015e-06 2.8388e-06 4.4483

You might also like