Azzera filtri
Azzera filtri

Why my graphic always on straight line?

2 visualizzazioni (ultimi 30 giorni)
Nugroho Wisnumurti
Nugroho Wisnumurti il 8 Dic 2023
Risposto: Sam Chak il 8 Dic 2023
clc
clear
%% Nilai Data
Ip = 0.004026
Mp = 0.419
L = 0.108
Ir = 0.000189
Mr = 0.204
Im = 0.00548
Mm = 0.112
g = 10
%Equation
A1 = ((Mp+Mr+Mm)*g*L)/((Im+Ir+Ip)-Ir+(Mp+Mr+Mm)+L^2);
B1 = 1/((Im+Ir+Ip)-Ir+(Mp+Mr+Mm)+L^2);
B2 = ((1/Ir)+1/((Im+Ir+Ip)-Ir+(Mp+Mr+Mm)+L^2));
%Matriks
A = [0 0 1 0; 0 0 0 1; 0 A1 0 0; 0 A1 0 0];
B = [0;0;B1;B2];
C = [1 0 0 0; 0 1 0 0; 0 0 1 0; 0 0 0 1];
D = [0];
%% controllability
sys = ss(A,B,C,D);
Co = ctrb(sys)
Con = rank(Co)
%% stability
%tambahan
eig(A)
%% Polynomial Characteristic ITAE Method
Wn = 1.5
ITAE = [1 (2.1*Wn) (3.4*Wn^2) (2.7*Wn^3) (Wn^4)]
Roots1 = roots(ITAE)
K = place(A,B,Roots1)
Acl = A-B*K
E2 = eig(Acl)
Pcl = place(A,B,E2)
%% Call Simulink
[Out] = sim('simulasi.slx')
figure(1)
plot(Out.tout, Out.XITAE1);
title('Grafik response');
xlabel('Time');
ylabel('radian');
grid on;
  2 Commenti
Walter Roberson
Walter Roberson il 8 Dic 2023
We have no information about what your model does.
Sulaymon Eshkabilov
Sulaymon Eshkabilov il 8 Dic 2023
Spostato: Dyuman Joshi il 8 Dic 2023
Post your simulink model simulasi.slx. Nobody can guess what you have in your Simulink model.

Accedi per commentare.

Risposte (1)

Sam Chak
Sam Chak il 8 Dic 2023
Although you haven't provided the Simulink file 'simulasi.slx', I believe your result indicates that the system is in equilibrium (0, 0, 0, 0). What happened is that you simulated the model in Simulink with zero initial conditions and injected zero input. Naturally, the states will remain at the equilibrium value throughout the simulation unless you either inject a non-zero external input or use non-zero initial conditions. Three cases are demonstrated below, and yours most likely belongs to Case 2.
%% Nilai Data
Ip = 0.004026;
Mp = 0.419;
L = 0.108;
Ir = 0.000189;
Mr = 0.204;
Im = 0.00548;
Mm = 0.112;
g = 10;
% Equation
A1 = ((Mp+Mr+Mm)*g*L)/((Im+Ir+Ip)-Ir+(Mp+Mr+Mm)+L^2);
B1 = 1/((Im+Ir+Ip)-Ir+(Mp+Mr+Mm)+L^2);
B2 = ((1/Ir)+1/((Im+Ir+Ip)-Ir+(Mp+Mr+Mm)+L^2));
% Matriks
A = [0 0 1 0;
0 0 0 1;
0 A1 0 0;
0 A1 0 0];
B = [ 0;
0;
B1;
B2];
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1]; % Sam: this is identity matrix, eye(4)
D = [0];
%% controllability
sys = ss(A, B, C, D);
Co = ctrb(sys);
Con = rank(Co);
%% stability
%tambahan
eig(A)
ans = 4×1
0 0 1.0246 -1.0246
%% Polynomial Characteristic ITAE Method
Wn = 1.5;
ITAE = [1 (2.1*Wn) (3.4*Wn^2) (2.7*Wn^3) (Wn^4)]; % Sam: most likely from Dorf & Bishop
Roots1 = roots(ITAE);
K = place(A,B,Roots1)
K = 1×4
0.0009 0.0016 0.0016 0.0006
Acl = A-B*K;
E2 = eig(Acl);
Pcl = place(A,B,E2);
%% Compensated system via pole-placement method
csys = ss(A-B*K, B, C, D);
N = 1/dcgain(csys);
csys = ss(A-B*K, B*N(1), C, D)
csys = A = x1 x2 x3 x4 x1 0 0 1 0 x2 0 0 0 1 x3 -0.001205 1.048 -0.00217 -0.0007866 x4 -4.824 -7.649 -8.683 -3.148 B = u1 x1 0 x2 0 x3 0.001205 x4 4.824 C = x1 x2 x3 x4 y1 1 0 0 0 y2 0 1 0 0 y3 0 0 1 0 y4 0 0 0 1 D = u1 y1 0 y2 0 y3 0 y4 0 Continuous-time state-space model.
%% Case 1: Time response when input u is Unit-Step & initial condition is zero
step(csys), grid on, title('Case 1: Time Response with step input & zero x0')
%% Case 2: Time response when both input u & initial condition are zero
t = linspace(0, 12, 1201);
u = zeros(1, numel(t));
lsim(csys, u, t), grid on, title('Case 2: Time Response with zero input & zero x0')
%% Case 3: Time response when input u is zero & initial condition is non-zero
t = linspace(0, 12, 1201);
u = zeros(1, numel(t));
x0 = [1 0 0 0]; % initial condition
lsim(csys, u, t, x0), grid on, title('Case 3: Time Response with zero input & non-zero x0')
%% Call Simulink
% [Out] = sim('simulasi.slx')
% figure(1)
% plot(Out.tout, Out.XITAE1);
% title('Grafik response');
% xlabel('Time');
% ylabel('radian');
% grid on;

Categorie

Scopri di più su Dynamic System Models in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by