Why my graphic always on straight line?
조회 수: 2 (최근 30일)
이전 댓글 표시
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;
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1563289/image.jpeg)
댓글 수: 2
Sulaymon Eshkabilov
2023년 12월 8일
이동: Dyuman Joshi
2023년 12월 8일
Post your simulink model simulasi.slx. Nobody can guess what you have in your Simulink model.
답변 (1개)
Sam Chak
2023년 12월 8일
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)
%% 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)
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)
%% 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;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Dynamic System Models에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!