MATLAB This is the code I have so far from the previous code that goes with part
ID: 3682531 • Letter: M
Question
MATLAB
This is the code I have so far from the previous code that goes with part 2 but it needs to be changed to include air density calculated by the function in part 1
Cd=1; %drag coefficient
p=1.1; %air density (kg/m^3)
A=1; %cross sectional area of skydiver (m^2)
m=80; %mass (kg)
ri=0.5; %initial radius (m)
rf=3.6; %final radius (m)
h=4000; %starting height
dt=0.1; %time step
g=9.81; %gravity
t=0;
v=0;
n=1;
tdeploy=0; %time after deployment
topen=3.2; %time required for the chute to deploy
while h>0
if t<60 %before parachute opens
dv=(g-1/6*v)*dt; %change in velocity start
v=v+dv;
dh=v*dt; %change in height
h=h-dh;
t=t+dt;
a=g+((0.5*Cd*p*A*v^2)/m); %acceleration
elseif t<=63.2 %parachute opening
td=t-60;
c=ri;
b=3*(rf-ri)/(topen^2);
a=(-2*b)/(2*topen);
Radius=a*tdeploy^3+b*tdeploy^2+c;
Area=pi*Radius^2;
dv=(g-1/6*v)*dt; %change in velocity
v=v+dv;
dh=v*dt; %change in height
h=h-dh;
t=t+dt;
a=g+((0.5*Cd*p*Area*v^2)/m); %acceleration
else %after parachute is completely open
dv=(g-5/3*v)*dt; %change in velocity change when opened
v=v+dv;
dh=v*dt; %change in height
h=h-dh;
t=t+dt;
a=g+((0.5*Cd*p*3.6*v^2)/m); %acceleration
end
hp(n)=h; %array of height
vp(n)=v; %array of velocity
ap(n)=a; %array of acceleration
n=n+1; %number of time loop goes
end
te=dt*(1:n-1);
subplot(3,1,1)
plot(te,vp)
xlabel('Time (sec)')
ylabel('Velocity (m/s)')
title('Time vs Velocity')
subplot(3,1,2)
plot(te,hp)
xlabel('Time (sec)')
ylabel('Height (m)')
title('Time vs Height')
subplot(3,1,3)
plot(te,ap)
xlabel('Time (sec)')
ylabel('Acceleration (m/sec^2)')
title('Time vs Acceleration')
Explanation / Answer
d1=52;
d2=27;
x1=12;
x2=15;
x=10;
d=d1+(d2-d1)*(x-x1)/(x2-x1);
for i from 0 to 4000 do
d=d1+(d2-d1)*(x-x1)/(x2-x1);
plot(i,d);
end for
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.