Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

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')

OVERVIEW Both in reality and in the formulation of Newtonian Friction, the density of the frictional medium (for a parachutist the medium is air) affects drag. Because a sky-dive begins at such a high altitude, the air density is different nearer the beginning of jump than nearer the end of the jump. The following table can be used to create a user-defined function that will calculate the approimate air density (kg/m3) given an input of altitude (m). Use linear interpolation similar to the homework User-defined functions). The following data can be used in the function file. Altitude, m Density, kg/m 610 1219 1829 2438 3048 3658 4267 1.290 1.216 1.146 1.078 1.014 0.952 0.894 0.839 STEPS 1. CREATE FUNCTION FOR AIR DENSITY USING LINEAR INTERPOLATION Create a function that, given the altitude of the parachutist, will return the air density found by linearly interpolating between the data from the above table (i.e. given one altitude at a time, return the linearly interpolated density value for that altitude). If you have data values d1 and d2 at two points x1 and x2, respectively, then the estimated d at a point x between x1 and x2 is given by: d = d1+ (d2-d1)"(x-x1)/(x2-x1) Test your function with a MATLAB script: (1) calculate density for sufficient altitudes between 0 and 4000 meters and (2) generate a clear plot of altitude (y-axis) versus air density (x-axis). Submit your plot and test code. Note: you may not use MATLABs built-in interpolation functions (e.g., interp1, etc.) 2. RUN SIMULATION WITH NEWw FUNCTION FOR AIR DENSITY (RHO) Once your function works, change your parachute model to properly use the air density calculated by your function. Once again, make plots of height, velocity, and acceleration vs time using subplot. Submit copies of your code followed by your figures using the publish feature of MATLAB

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