Wave Generator 2
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
(a general understanding of what the model is trying to show or explain)
HOW IT WORKS
(what rules the agents use to create the overall behavior of the model)
HOW TO USE IT
(how to use the model, including a description of each of the items in the Interface tab)
THINGS TO NOTICE
(suggested things for the user to notice while running the model)
THINGS TO TRY
(suggested things for the user to try to do (move sliders, switches, etc.) with the model)
EXTENDING THE MODEL
(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)
NETLOGO FEATURES
(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)
RELATED MODELS
(models in the NetLogo Models Library and elsewhere which are of related interest)
CREDITS AND REFERENCES
(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)
Comments and Questions
globals [ frequency-change-up volume-change-up frequency-change-down volume-change-down new-f-value new-v-value ] to setup clear-all set new-f-value -1 set new-v-value -1 end to go if new-f-value != frequency or new-v-value != volume [update-all-plots] end to update-all-plots update-this-plot "Graph 1" 1 update-this-plot "Graph 2" .1 update-this-plot "Graph 3" .01 update-this-plot "Graph 4" .001 set new-f-value frequency set new-v-value volume end to update-this-plot [graph-name x-delta] let x-counter 0 set-current-plot graph-name clear-plot draw-grid x-delta repeat 3999 [ plotxy x-counter (20 + (volume / 100) * (9 * sin ((x-counter * 1 * frequency) * 360))) if graph-name = "Graph 1" and frequency > 1000 [ plotxy x-counter (20 + 9) plotxy x-counter (20 - 9) ] set x-counter x-counter + (x-delta / 4000) ] end to draw-grid [x-delta] set-current-plot-pen "grid" let y-increment 15 let x-increment 0 repeat 3 [ plotxy x-delta y-increment plot-pen-down plotxy 0 y-increment plotxy x-delta y-increment set y-increment y-increment + 5 plot-pen-up ] repeat 9 [ plotxy x-increment 10.01 plot-pen-down plotxy x-increment 10.01 plotxy x-increment 29.99 set x-increment x-increment + (x-delta / 10) plot-pen-up ] set-current-plot-pen "default" set-plot-pen-color black end to more-frequency-up-one if frequency < 1000 [ set frequency frequency + 1 ] set frequency-change-up false end to more-volume-up-one if volume < 100 [ set volume volume + 1 ] set volume-change-up false end to less-volume-down-one if volume > 0 [ set volume volume - 1 ] set frequency-change-down false end to less-frequency-down-one if frequency > 0 [ set frequency frequency - 1 ] set volume-change-down false end to more-frequency-double if frequency <= 500 [ set frequency (frequency * 2) ] set frequency-change-up false end to less-frequency-half if frequency >= 2 [ set frequency round (frequency * 0.5) ] set volume-change-down false end to more-volume-double if volume <= 500 [ set volume (volume * 2) ] set frequency-change-up false end to less-volume-half if volume <= 2 [ set volume round (volume * 0.5) ] set volume-change-down false end
There is only one version of this model, created over 7 years ago by Michael Novak.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Wave Generator 2.png | preview | Preview for 'Wave Generator 2' | over 7 years ago, by Michael Novak | Download |
This model does not have any ancestors.
This model does not have any descendants.