Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1496
Number of posts: 2176

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
terminal velocity graphing Posted by wvu12 on 24 Mar 2009 at 7:17 AM
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
Attachment: Finalcodeproject2.m (1574 Bytes | downloaded 130 times)
Report
Re: terminal velocity graphing Posted by giug on 24 Mar 2009 at 9:24 AM
I can't understand what is your problem, in your code you already plot the altitude as a function of time.
Report
Re: terminal velocity graphing Posted by wvu12 on 24 Mar 2009 at 9:37 AM
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
Report
Re: terminal velocity graphing Posted by giug on 24 Mar 2009 at 10:08 AM
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);
Report
Re: terminal velocity graphing Posted by wvu12 on 24 Mar 2009 at 11:43 AM
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.
Attachment: project2.m (1331 Bytes | downloaded 76 times)
Report
Re: terminal velocity graphing Posted by giug on 24 Mar 2009 at 12:11 PM
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.
Report
Re: terminal velocity graphing Posted by wvu12 on 24 Mar 2009 at 12:23 PM
initial altitude is 3800
parachute diameter is 10
opens at 40
time step is .1
Report
Re: terminal velocity graphing Posted by giug on 24 Mar 2009 at 12:37 PM
Now it runs!
To plot all the velocity values you have to code in this way (I underline the lines that I have added):

figure();
while t<TO && Alt>1000
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
plot(t,V,'.');hold on
end
Report
Re: terminal velocity graphing Posted by giug on 24 Mar 2009 at 12:50 PM
To plot the altitude:

figure();
while Alt>0
Alt=Alt-Vt_after*TS;
t=t+TS;
plot(t,Alt,'.');hold on
end
Report
Re: terminal velocity graphing Posted by wvu12 on 24 Mar 2009 at 1:15 PM
thank you, we modified what you gave us to graph for the entire duration of the jump.



 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.