quadcopter vertical dynamics modelling

1 view (last 30 days)
almaz ham
almaz ham on 18 Feb 2015
Hello. I try to get state-space model of my quadcopter vertical motion under gravity.
I can't simulate effect of gravity. For this i try to add matrix K to my state-space model, but without success. There is no difference if i use:
sys = idss(A,B,C,D,K,x0,timestep)
or
sys = ss(A,B,C,D,timestep)
Result same. There is code:
clear all
timestep = 0.002;
m = 0.0027;
g = 9.81;
T_hover = 20000;
Kt = g*m/T_hover;
A = [1 timestep ; 0 1];
B = [+(Kt/m)*(timestep^2)/2 ; +(Kt/m)*timestep];
K = [ -(g)*(timestep^2)/2 ; -(g)*timestep];
C = [1 0];
D = [0];
x0 = [0; 0];
sys = idss(A,B,C,D,K,x0,timestep)
length = 2000;
inputm = zeros(length,1);
inputm(300:500) = 25000;
t = 0:timestep:(length-1)*timestep;
[y_m,t_m,x_m] = lsim(sys,inputm,t,x0);
subplot(2,1,1);
plot(inputm);
title('input thrust');
ylim([-1000 26000]);
subplot(2,1,2);
plot(x_m);
legend('coordinate','speed');
Maybe i missed something obvious. Help me please.

Answers (0)

Categories

Find more on Dynamic System Models in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!