clg
fastgraphics
rem Initial variables
speed = 0:pullforce=500
mass=40: dist =0 :time=0 :frictioncoef=.5
dt=0.005 : c=0 : fforce=mass*9.81*frictioncoef
acc=((pullforce-fforce)/mass)*dt
while time<30
clg
if pullforce > fforce then speed = speed + acc
dist = dist + (speed)*dt
time = time + dt
text 10,10 ,"Time "+time+" sec"
text 10,20, "Speed "+speed+"m/s"
text 10,30 ,"Distance "+int(dist)+"m"
text 10,40 ,"Acceleration "+((pullforce-fforce)/mass)+"m/s^2"
text 130,120 ,"Mass "+mass+"Kg"
text 10,140 ,fforce+" N <---Friction ---------------------------Pull--->"+pullforce+" N"
rect 120,145,60,20
c=c + (speed)*dt
text 1-c,155,"......................................."+(dist-c)+"m .............................................................."
if 150-c<0 then c=c-150
refresh
end while
Tuesday, October 26, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment