功能描述:
据对四旋翼的模型进行受力分析,推到出四旋翼的机理模型,根据机理模型,在simulink里搭建系统框图,给系统一定放入输入,将仿真出四旋翼的运动轨迹。
% Simulation times, in seconds.
start_time = 0;
end_time = 10;
dt = 0.005;
times = start_time:dt:end_time;
% Number of points in the simulation.
N = numel(times);
% Initial simulation state.
x = [0; 0; 10];
xdot = zeros(3, 1);
theta = zeros(3, 1);
% Simulate some disturbance in the angular velocity.
% The magnitude of the deviation is in radians / second.
deviation = 100;
thetadot = deg2rad(2 * deviation * rand(3, 1) - deviation);
% Step through the simulation, updating the state.
for t = times
% Take input from our controller.
i = input(t);
omega = thetadot2omega(thetadot, theta);
% Compute linear and angular accelerations.
a = acceleration(i, theta, xdot, m, g, k, kd);
omegadot = angular_acceleration(i, omega, I, L, b, k);
omega = omega + dt * omegadot;
thetadot = omega2thetadot(omega, theta);
theta = theta + dt * thetadot;
xdot = xdot + dt * a;
x = x + dt * xdot;
end
联系:highspeedlogic
QQ :1224848052
微信:HuangL1121
邮箱:1224848052@qq.com
网站:http://www.mat7lab.com/
网站:http://www.hslogic.com/
微信扫一扫:
|