Hi guys! I have to write a program to simulate a jump with a parachute, actually i have written a part without opening the parachute. But if I try running it I keep getting this error:

??? Error using ==> plus

Matrix dimensions must agree.

Error in ==> parachute at 24

s=[s,s+ds];

My source code:

Code:

clear all
m=90; % mass of jumper
cm=0.43; % cw-Value (value of the air-resistance)
Am=1; % "surface area" of jumper
g=9.81;
roh=1.2929; % density air
dt=1; % at which interval values will be calculated
h=2000; % total height
k=(cm*Am*roh)/2; % constant part of the formula for acceleration with air-resistance
a=g; % a at beginning
v=0; % v at beginning
t=0; % t at beginning
s=0; % s(height jumper already passed) at beginning
% jump's duration
ti=h/(sqrt(2*m*g/(cm*Am*roh)));
ti=floor(ti);
for t=1:dt:ti
ds=v*dt;
s=[s,s+ds];
a=[a,g-(k/m)*v^2];
dv=a*dt;
v=[v,v+dv];
t=[1:0.1:ti];
end
plot(t,v,'b')
grid on
hold on
plot(t,a,'r')
grid on
hold on

I'd be very happy if someone could help me.

Sorry if my English isn't really good at some points, even so I hope you can understand it

Best regards,

unique