Local averaging with custom neighbourhood

Local averaging with custom neighbourhood preview image

1 collaborator

Tags

local averaging with noise 

Tagged by Oleksii Ignatenko almost 2 years ago

Visible to everyone | Changeable by the author
Model was written in NetLogo 6.3.0 • Viewed 146 times • Downloaded 19 times • Run 0 times
Download the 'Local averaging with custom neighbourhood' modelDownload this modelEmbed this model

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

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

Click to Run Model

patches-own [ c ]

to setup
  clear-all
  ask patches [
    set c 0
    set pcolor white
  ]
    reset-ticks
end 

to go
  my-diffuse
  colour-patches
  tick
end 

to my-diffuse
  ask patches [
    let level 0
    let n 0
    if x-1y-1 = 1 [
      set n n + 1
      set level level + [c] of patch-at -1 -1]

    if x-1y = 1 [
      set n n + 1
      set level level + [c] of patch-at -1 0]

    if x-1y+1 = 1 [
      set n n + 1
      set level level + [c] of patch-at -1 1]

    if xy-1 = 1 [
      set n n + 1
      set level level + [c] of patch-at 0 -1]

    if xy+1 = 1 [
      set n n + 1
      set level level + [c] of patch-at 0 1]

    if x+1y-1 = 1 [
      set n n + 1
      set level level + [c] of patch-at 1 -1]

    if x+1y = 1 [
      set n n + 1
      set level level + [c] of patch-at 1 0]

    if x+1y+1 = 1 [
      set n n + 1
      set level level + [c] of patch-at 1 1]

    if x-2y-2 = 1 [
      set n n + 1
      set level level + [c] of patch-at -2 -2]

    if x+2y+2 = 1 [
      set n n + 1
      set level level + [c] of patch-at 2 2]


    set c (1 - weight-w) * c + weight-w * level / n + noise-level * one-of [-1 1]
  ]
end 

to colour-patches
  ask patches with [pcolor != black][
    ifelse c > threshold [set pcolor black][ set pcolor scale-color red c threshold 0]]
end 

There is only one version of this model, created almost 2 years ago by Oleksii Ignatenko.

Attached files

File Type Description Last updated
Local averaging with custom neighbourhood.png preview Preview for 'Local averaging with custom neighbourhood' almost 2 years ago, by Oleksii Ignatenko Download

This model does not have any ancestors.

This model does not have any descendants.