資源簡介
倒立擺設(shè)計(jì),包含極點(diǎn)配置,穩(wěn)定性測(cè)試等,matlab源碼,真實(shí)可用
代碼片段和文件信息
%The?simulation?of?the?stable?pendulum?cart
%using?PIDpoleplacement?and?LQR
clc;
clear;
%parameter
m?=?0.09;??????????????%?The?pendulum?mass:?m?=?0.09kg;
M?=?1.52;??????????????%?The?mobile?cart?mass:?M?=?1.52kg;
L?=?0.24;??????????????%?The?1/2?length?of?the?pendulum:?L?=?0.24m;
I?=?m*(2*L)*(2*L)/12;??%?The?inertia?of?the?pendulum:?I?=?m*(2L)^2/12;
Ts?=?0.015;????????????%?The?sampling?time;????
g?=?9.81;??????????????%?The?gravity?accelation:?g?=?9.81?N/m;
%modeling
temp_den?=?(m+M)*I+m*M*L*L;?
i?=?m*g*L*(m+M)/temp_den;?
j?=?-m*m*L*L*g/temp_den;
A?=?[0?1?0?0;
????i?0?0?0;
????0?0?0?1;
????j?0?0?0];?
B?=?[0?-m*L/temp_den?0?(I+m*L*L)/temp_den]‘;
C?=?[1?0?0?0;
????0?0?1?0];?
D?=[0?0]‘;
[G?H]=c2d(ABTs);
x0=[-0.2?0?0.2?0]‘;
t=0:Ts:3;
u=zeros(size(t));
%without?c
評(píng)論
共有 條評(píng)論