Skip to content

Commit b8f8897

Browse files
committed
doc: basic example
1 parent 4b423a5 commit b8f8897

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/src/index.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,26 @@ To use some light field data types, you need to add [Unitful.jl](https://painter
1616
```julia
1717
Pkg.add("Unitful")
1818
```
19+
20+
## Basic Examples
21+
22+
Draw a cross hole and its diffraction pattern:
23+
24+
```@example
25+
using OpticalPropagation
26+
using Unitful
27+
using Plots
28+
29+
cross = MonoLightField2D(
30+
[Int((abs(x)<10 && abs(y)<50) || (abs(x)<50 && abs(y)<10)) for y in -200:199, x in -200:199],
31+
wavelength=632.8u"nm",
32+
size=(1u"mm",1u"mm")
33+
)
34+
patt = angularspectrum(cross, 1u"cm")
35+
36+
plot(
37+
plot(cross, size=(420,400)),
38+
plot(patt, size=(420,400)),
39+
size=(840,400)
40+
)
41+
```

0 commit comments

Comments
 (0)