Poles placement - Simple damped pendulum
Show older comments
Helow, everyone!
I'm having some trouble to analize and model the sysyem consisted of a simple damped pendulum, described by this equation:
To procceed with alocation of the poles of the system, I'm previously determining the frequency and the damp ratio and, then, getting the values of the poles, through this equation:
In the next step, I used this poles, called raiz_1 and raiz_2 in my code, in the function "place" , in wich A e B are the state and the control matrices of the linearized corresponding system.
Below, you can see my code:
w0=0;
theta0 =pi/4;
ti=0;
tf=100;
omega_0=3.0;
epsilon=1.27;
raiz_1=(-1)*epsilon*omega_0+sqrt(omega_0^2*(epsilon^2-1))
raiz_2=(-1)*epsilon*omega_0-sqrt(omega_0^2*(epsilon^2-1))
A=[0 1;-10 -1];
autovalrs_A=eig(A);
B=[0;1];
p=[raiz_1;raiz_2];
[K,prec,message]= place(A,B,p)
k1=K(1,1);
k2=K(1,2);
u=@(x)((-1)*K*x);
%[vetort vetorv]=ode45(@(t,x)dinamica(t,x-0.2,u(x-0.2)),[ti tf],[w0;theta0]);
[vetortlin vetorvlin]=ode45(@(t,x)linearization(x-3,u(x-3)),[ti tf],[w0;theta0]);
figure('color' ,'w' );
grid on
%plot(vetort,vetorv(:,2),'r') ;
%hold on
plot(vetortlin, vetorvlin(:,2 ),'b') ;
legend('Linearizado' );
%title('\theta_{0} = 0 , \omega_{0} = \pi/4 , Q=[1 0;0 1] e R=[2 0;0 1]' ) ;
xlabel('tempo ( s )' ) ;
ylabel( 'posição( rad )' ) ;
function Xp = dinamica(t,x,u)
m=1;
g=10;
L=1;
b=1;
sp=x(1); %velocidade
vp=(1/(m*L^2))*(u-(b)*x(1)-m*g*sin(x(2)));
Xp=[vp;sp];
end
function Lin = linearization(x,torque)
A=[0 1;-10 -1];
B=[0;1];
vetor = A*[x(2);x(1)]+B*torque;
Lin = [vetor(2);vetor(1)];
end
My problem is that the results are not consistent. Because, when I put a damped ration lower than one, the system doesn't show an oscilatory behavior and, sometimes, it diverges even when the poles are complex numbers with negatives real parts.
Someone could please help me to identify the source of this problem?
Answers (0)
Categories
Find more on MATLAB in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!