#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

#### Categories

Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# terminal velocity graphing

Posts: 12Member
i need to be able to plot the vertical speed and the altitude as a function of time. attached is the code. any help would be appreciated
· ·

• Posts: 217Member
I can't understand what is your problem, in your code you already plot the altitude as a function of time.
· ·
• Posts: 12Member
the graph is not plotting properly and i do not know how to get it to look the right way, also need to have seperate plots for the velocity and altitude
· ·
• Posts: 217Member
If you don't explain what you mean with "plot properly" I can't help you.
To plot two different figures you can code in this way:

figure(); plot(time, altitude);
figure(); plot(time, velocity);
· ·
• Posts: 12Member
the velocity graph was only using one point for the entire graph, we need it to use all the points for the velocity graph. i also can't figure out how to get the altitude to plot. attached is the revised information.
· ·
• Posts: 217Member
Can you give me some test input values so that I can check the code, because it gives me some errors and perhaps it depends on my "random" input values.
· ·
• Posts: 12Member
initial altitude is 3800
parachute diameter is 10
opens at 40
time step is .1
· ·
• Posts: 217Member
Now it runs!
To plot all the velocity values you have to code in this way (I underline the lines that I have added):

[u]figure();[/u]
while t1000
if V>-Vt_before
a=(1/2)*(pair/m)*(V^2)*Ab*Cdb-g;
V=Vi+a*TS;
Alt=Alt+V*TS+(1/2)*a*TS^2
Vi=V;
t=t+TS
time=t;
disp('The skydiver did not reach terminal velocity.')
else Vterm=1;
Alt=-Vt_before*TS+Alt
t=t+TS
disp('The skydiver reached terminal velocity.')
end
[u]plot(t,V,'.');hold on[/u]
end
· ·
• Posts: 217Member
To plot the altitude:

[u]figure();[/u]
while Alt>0
Alt=Alt-Vt_after*TS;
t=t+TS;
[u]plot(t,Alt,'.');hold on[/u]
end
· ·
• Posts: 12Member
thank you, we modified what you gave us to graph for the entire duration of the jump.
· ·