125k views
2 votes
6. Data are given in comma delimited text file for a toy rocket. The rocket is powered by pressurized water that is discharged from the nozzle at the beginning of the flight. a. Plot the elevation as a function of time b. Compute and plot the velocity and acceleration of the rocket as functions of time c. Write matlab code that will automatically determine the thruster time, the maximum altitude, the maximum velocity, and the maximum acceleration d. The tip of the rocket transports a 2.7 gram ping-pong ball. Determine the maximum support force for the ball.

User Gallaugher
by
3.8k points

1 Answer

3 votes

Answer:

load('ROCKET_DATA.CSV')

m=ROCKET_DATA;

plot(m(:,1),m(:,2))

hold on

x=m(:,1);y=m(:,2);

b=length(m);

%% finding/plotting velocity

for i=2:b

if i==b

v(i)=NaN;

else

%v(i)=(y(i+1)-y(i-1))/(2*(x(i+1)-x(i-1))); centered difference

v(i)=(y(i+1)-y(i))/(x(i+1)-x(i)); %forward difference

end

end

plot(x,v);

%% finding acceleration

for i=3:b

if i==b

a(i)=NaN;

else

a(i)=(y(i+1)-2*y(i)+y(i-1))/(x(i+1)-x(i-1))^2; %cd of 2nd dy/dx

end

end

plot(x,a)

%% Max altitude

maxy=y(1);

for i=1:length(x)

if y(i)>maxy

maxy=y(i);

end

end

%% maximum velocity

maxa=v(1);

for i=1:length(v)

if v(i)>maxa

maxa=v(i);

end

end

%% maximum acceleration

maxa=a(1);

for i=1:length(a)

if a(i)>maxa

maxa=a(i);

end

end

%% Free body

mass=2.7;%gram

mass=.0027;%kilogram

N=mass*maxa; %(N); %N=the opposing force (minimum strength of the nose cone) at the maximum downward force

%% thruster time

t=0;

for i=1:length(a)

if a(i) < 0

t=i;

return

end

end

User Camford
by
4.4k points