-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRemarkable notebook.jl
More file actions
110 lines (89 loc) · 3.6 KB
/
Remarkable notebook.jl
File metadata and controls
110 lines (89 loc) · 3.6 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
### A Pluto.jl notebook ###
# v0.19.46
using Markdown
using InteractiveUtils
# ╔═╡ 55f5d165-9d99-4fae-bf01-ebbf095935d1
begin
using Pkg
Pkg.add("Plots")
end
# ╔═╡ bfd98b62-01e6-4734-b54e-505722b2c88c
begin
Pkg.add("DSP")
using DSP
end
# ╔═╡ 0082c722-5c50-425d-9d90-d44e5d912c09
begin
using Plots
plot(c, title="Plot of c", ylab="c", legend=false)
end
# ╔═╡ abb949e2-8699-11ef-0a83-130d7c64b59a
#Solution for A7.1
include("channel_equalization_data.jl")
# ╔═╡ b175c3d4-be86-4661-aa5d-94f98fcb242e
begin
#Printing to get an idea of the variables
println("Message(s)=",s[1:10])
println("Channel(c)=",c)
println("Equilizer(h)=",h)
end
# ╔═╡ 90e1ac9f-cbd4-4cbe-8ec1-1f3b2395325b
plot(h, title="Plot of h", ylab="h", legend=false)
# ╔═╡ 64648da8-08ed-4145-8842-f2186b788b49
c_equalized=conv(h,c)
# ╔═╡ e53e1df6-ed0d-4e94-94ad-6124e72fe597
plot(c_equalized, title="Plot of c (equalized)", ylab="c (equalized)", legend=false)
# ╔═╡ 49a8643f-6e33-497f-928d-dfb71a4d3d2d
begin
println("The channel introduces some noise in the original message causing the received message being somewhat different from the original message. The channel equalizer tries to negate the effect of the noise introduced by the channel, causing the message received to be as close to the original message as possible.")
end
# ╔═╡ e22bac11-e394-4f6f-b946-246334725e43
begin
y=conv(c,s)
y_tilda=conv(h,y)
end
# ╔═╡ 25a8e476-df0d-49e4-b6eb-5565ce3af950
plot(s[1:100], title="Plot of s", ylab="s", legend=false)
# ╔═╡ 9d35864a-0671-4c29-80c4-94ecd21d1c3b
plot(y[1:100], title="Plot of y", ylab="y", legend=false)
# ╔═╡ 54db299d-bedf-4056-8e2f-0ada89554447
plot(y_tilda[1:100], title="Plot of y(tilda)", ylab="y_tilda", legend=false)
# ╔═╡ 79a564ca-5cb4-41e1-bf4d-768ed34ea9c8
s_cap=Int.(y[1:100].>0.5)
# ╔═╡ 0b7b4da8-5d52-426c-8045-ea9350ded47d
s_cap_eq=Int.(y_tilda[1:100].>0.5)
# ╔═╡ 78bd069a-ea87-44a5-9996-3d1d394c2f86
plot(s_cap, title="Plot of s(cap)", ylab="s_cap", legend=false)
# ╔═╡ b6367e01-d057-4cc9-b7f1-09b2a2f4a191
plot(s_cap_eq, title="Plot of s_cap(eq)", ylab="s_cap_equalized", legend=false)
# ╔═╡ 2289fab8-a592-4248-b786-04cee1145ae7
println("Comparing the plots of s_cap and s_cap_equalized with the plot of s, we can see that the equalized message plot (s_cap_equalized) is more similar to the original message indicating that the equalized message is more accurate, while s_cap is a worse estimate.")
# ╔═╡ a8136d3f-dcba-4f66-a7d9-983742c0a7e9
begin
db=s[1:100].-s_cap #db is the difference in bits
BER=sum(abs.(db))/100
db_eq=s[1:100].-s_cap_eq
BER_eq=sum(abs.(db_eq))/100
println("BER without using equalization=",BER)
println("BER using equalization=",BER_eq)
end
# ╔═╡ Cell order:
# ╠═abb949e2-8699-11ef-0a83-130d7c64b59a
# ╠═55f5d165-9d99-4fae-bf01-ebbf095935d1
# ╠═b175c3d4-be86-4661-aa5d-94f98fcb242e
# ╠═0082c722-5c50-425d-9d90-d44e5d912c09
# ╠═90e1ac9f-cbd4-4cbe-8ec1-1f3b2395325b
# ╠═bfd98b62-01e6-4734-b54e-505722b2c88c
# ╠═64648da8-08ed-4145-8842-f2186b788b49
# ╠═e53e1df6-ed0d-4e94-94ad-6124e72fe597
# ╠═49a8643f-6e33-497f-928d-dfb71a4d3d2d
# ╠═e22bac11-e394-4f6f-b946-246334725e43
# ╠═25a8e476-df0d-49e4-b6eb-5565ce3af950
# ╠═9d35864a-0671-4c29-80c4-94ecd21d1c3b
# ╠═54db299d-bedf-4056-8e2f-0ada89554447
# ╠═79a564ca-5cb4-41e1-bf4d-768ed34ea9c8
# ╠═0b7b4da8-5d52-426c-8045-ea9350ded47d
# ╠═78bd069a-ea87-44a5-9996-3d1d394c2f86
# ╠═b6367e01-d057-4cc9-b7f1-09b2a2f4a191
# ╠═2289fab8-a592-4248-b786-04cee1145ae7
# ╠═a8136d3f-dcba-4f66-a7d9-983742c0a7e9