Wave Generator 2
Model was written in NetLogo 6.0.2
•
Viewed 143 times
•
Downloaded 12 times
•
Run 0 times
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
Comments and Questions
Please start the discussion about this model!
(You'll first need to log in.)
Click to Run Model
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 6 years ago by Michael Novak.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Wave Generator 2.png | preview | Preview for 'Wave Generator 2' | over 6 years ago, by Michael Novak | Download |
This model does not have any ancestors.
This model does not have any descendants.