Springmotions

Springmotions preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.4.0 • Viewed 25 times • Downloaded 4 times • Run 0 times
Download the 'Springmotions' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

globals [
  tyngde-acceleration
  y         ; lodret position
  vy        ; lodret hastighed
  ay        ; lodret acceleration
  dt        ; tidsskridt
  k         ; fjederkonstant
]

to nulstil
  clear-all

  ask patches [ set pcolor cyan ] ;
  create-turtles 1 ; opret en kugle og tildel startværdier
  [
    setxy 0 30 ; start position
    set shape "square"
    set color red
    set size 8
    set heading 180 ; nedadrettet bevægelse
  ]
  set dt 0.1
  set y ([ycor] of turtle 0)
  set vy 0
  set k 2
  draw-spring
  reset-ticks
end 

; beregn ny position og fart

to go
  set vy vy - y * 2 / masse-af-lod * dt    ;   Hookes lov accelerationen er a=F/m=k*x/m
  set y y + vy * dt
  ask turtles
  [
    setxy xcor y
  ]
  draw-spring
  tick
end 

; beregn kinetisk energi: Ekin = (1/2)*m*v^2

to-report Ekin
  report 1 / 2 * masse-af-lod * ( vy ^ 2 )
end 

to draw-spring
  clear-drawing
  create-turtles 1 [
    setxy 0 50
    pendown
    set pen-size 3
    set color blue
    setxy xcor y
    die
  ]
end 

There is only one version of this model, created 2 months ago by Solveig Skadhauge.

Attached files

File Type Description Last updated
Springmotions.png preview Preview for 'Springmotions' 2 months ago, by Solveig Skadhauge Download

This model does not have any ancestors.

This model does not have any descendants.