dc_kalman
所属分类:matlab编程
开发工具:matlab
文件大小:35KB
下载次数:7
上传日期:2017-09-12 15:16:55
上 传 者:
担架快递员
说明: 在simulink中实现了线性卡尔曼滤波的功能,亲测可用
(In Simulink, the function of the linear Calman filter is realized, and pro test is available)
文件列表:
kalman_3_way.mdl (113932, 2010-07-15)
kalman_est.mdl (92923, 2010-07-15)
license.txt (1780, 2010-07-16)
% Copyright 2010 The MathWorks, Inc.
% roger.aarenstrup@mathworks.com
%
% This is a state-space DC motor model of a
% Maxon RE25 10 Watt, precious metal brushes, 118743
% This model also have a weak connection to a load.
%
% A kalman filter is designed to estimate internal states in
% the model. PLEASE OBSERVE THAT THE INTENTION WITH THIS IS
% TO SHOW DIFFERENT IMPLEMENTATIONS OF KALMAN FILTER IN SIMULINK.
% FOR CONTROL DESIGN AN OBSERVER SHOULD BE USED INSTEAD WITH
% REQUIREMENTS TO HAVE A HIGHER BANDWITH THAT THE OVERALL CONTROL
% LOOP FOR EXAMPLE. IN
% [http://www.mathworks.com/matlabcentral/fileexchange/12137-pid-and-state-feedback-control-of-dc-motors]
% THERE IS AN EXAMPLE OF OBSERVER DESIGN.
% For a theoretic background about Kalman filters, please see:
%
% 1. The doc page for the kalman function
% 2. http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.79.6578&rep=rep1&type=pdf
% 3. http://www.negenborn.net/kal_loc/thesis.pdf
% 4. http://sciyo.com/download/pdf/pdfs_id/10594
% 5. http://www.cs.unc.edu/~tracker/media/pdf/SIGGRAPH2001_CoursePack_08.pdf
% 6. ...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The full dc motor model %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Vin is the input voltage to the motor
% i is the motor current
% th_m is the rotor angle, theta
% dth_m is the rotor angular velocity sometimes called omega
% th_l is the load angle
% dth_l is the load angular velocity
% Controller Sample Time
Ts = 100e-6;
% PARAMETERS DC MOTOR
Rm = 2.06; % Motor resistance (ohm)
Lm = 0.000238; % motor inductance (Henrys)
Kb = 1/((406*2*pi)/60); % Back EMF constant (Volt-sec/Rad)
Kt = 0.0235; % Torque constand (Nm/A)
Jm = 1.07e-6; % Rotor inertia (Kg m^2)
bm = 12e-7; % MEchanical damping (linear model of
% friction: bm * dth)
% PARAMETERS LOAD
Jl = 10.07e-6; % Load inertia (10 times the rotor)
bl = 12e-6; % Load damping (friction)
Ks = 100; % Spring constant for connection rotor/load
b = 0.0001; % Spring damping for connection rotor/load
%% SYSTEM MATRICES
%
% States: [i dth_m th_m dth_l th_l]'
% Input: Vin the motor voltage
% Outputs: same as states
%
Afull = [-Rm/Lm -Kb/Lm 0 0 0;
Kt/Jm -(bm+b)/Jm -Ks/Jm b/Jm Ks/Jm;
0 1 0 0 0;
0 b/Jl Ks/Jl -(b+bl)/Jl -Ks/Jl;
0 0 0 1 0];
Bfull = [1/Lm 0 0 0 0]';
Cfull = [1 0 0 0 0
0 1 0 0 0;
0 0 1 0 0;
0 0 0 1 0;
0 0 0 0 1];
Dfull = [0 0 0 0 0]';
Cfull2 = [0 0 1 0 0];
Dfull2 = 0';
sys_full = ss(Afull, Bfull, Cfull2, Dfull2);
%% Discrete design
% First sample the continuous system
dsys = c2d(sys_full, Ts, 'zoh');
%%
% Manual implementatino of the kalman filter in the simulink models
% use the following
A = dsys.a;
B = dsys.b;
C = dsys.c;
Q = 1.001; % Process noise variance
R = 2.003; % Sensor noise variance
%% Kalman filter design in control system toolbox
% This example is very similar to the example in the documentation
% for the kalman function.
Plant = ss(A,[B B], C, 0, Ts,'inputname',{'u' 'w'},'outputname','y');
Q = 1.001; % Process noise variance
R = 2.003; % Sensor noise variance
[kalmf,L,Pp,M,Z] = kalman(Plant, Q, R, 'delayed');
近期下载者:
相关文件:
收藏者: