-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathfrequency-modulation.typ
More file actions
74 lines (70 loc) · 1.75 KB
/
Copy pathfrequency-modulation.typ
File metadata and controls
74 lines (70 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#import "@preview/cetz:0.5.2": canvas, draw
#import "@preview/cetz-plot:0.1.4": plot
#import draw: content, group, line, translate
#set page(width: auto, height: auto, margin: 8pt, fill: none)
#let domain-x(x) = 11 * x
#let msg(x) = 2 * calc.sin(2 * calc.pi * .25 * domain-x(x))
#let carrier(x) = 2 * calc.sin(6 * calc.pi * domain-x(x))
#let fm(x) = (
2
* calc.sin(
2 * calc.pi * 3 * domain-x(x) - 8 * calc.cos(2 * calc.pi * .25 * domain-x(x)),
)
)
#let samples = 1600
#let plot-height = 1.6
// @typstyle off
#let row(name, y, title, func, color, label-color: black, y-min: -1.35, y-max: 1.35) = {
let arrow = (mark: (end: "stealth", fill: black, scale: .55), stroke: .8pt)
let x-axis = name + "-x-axis"
let y-axis = name + "-y-axis"
let zero-y = (0 - y-min) / (y-max - y-min) * plot-height
line((0, y), (10.5, y), ..arrow, name: x-axis)
line((0, y - .95), (0, y + 1.15), ..arrow, name: y-axis)
content(x-axis + ".end", $t$, anchor: "west", padding: 2pt)
content(
(rel: (.14, -.15), to: y-axis + ".end"),
text(fill: label-color)[#title],
anchor: "south-west",
)
group({
translate((0, y - zero-y))
plot.plot(
size: (10.0, plot-height),
axis-style: none,
y-min: y-min,
y-max: y-max,
{
plot.add(
style: (stroke: color + 1.3pt),
domain: (0, 1),
samples: samples,
func,
)
},
)
})
}
#canvas({
row("msg", 4.6, $x(t)$, msg, black, y-min: -2.4, y-max: 2.4)
row(
"carrier",
2.05,
[carrier wave],
carrier,
blue,
label-color: blue,
y-min: -2.4,
y-max: 2.4,
)
row(
"fm",
-.6,
[FM wave],
fm,
green.darken(15%),
label-color: green.darken(15%),
y-min: -2.4,
y-max: 2.4,
)
})