From 3e86fb2e2d187220efb2038a26e68a37f1dc6ff5 Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 1 Nov 2021 15:37:41 +0100 Subject: Draw figure for frequency selective channels --- .../figures/data/multipath_frequency_response.py | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 doc/thesis/figures/data/multipath_frequency_response.py (limited to 'doc/thesis/figures/data/multipath_frequency_response.py') diff --git a/doc/thesis/figures/data/multipath_frequency_response.py b/doc/thesis/figures/data/multipath_frequency_response.py new file mode 100644 index 0000000..e5207ae --- /dev/null +++ b/doc/thesis/figures/data/multipath_frequency_response.py @@ -0,0 +1,35 @@ +import sys, os +import numpy as np + +nsamples = 300 + +np.seterr(over='raise') + +def tap(c, tau, f): + return np.exp(2j * np.pi * f * tau) + + +# attenuations for frequency plot +f_whole = np.logspace(5, 9, num=nsamples) +linear_whole = 1 / f_whole +multipath_whole = tap(c=.8, tau=500e-9, f=f_whole) + tap(c=.4, tau=300e-9, f=f_whole) +channel_whole = linear_whole * multipath_whole + +# coordinates for complex diagram +f_tap = np.linspace(2e6, 2.5e6, num=nsamples) +linear_tap = 1 / f_tap + +multipath_tap_1 = tap(c=.8, tau=500e-9, f=f_tap) +multipath_tap_2 = tap(c=.4, tau=300e-9, f=f_tap) +multipath_taps = multipath_tap_1 + multipath_tap_2 + +data = np.array(list(zip(f_whole, linear_whole, np.abs(channel_whole), + np.real(multipath_tap_1), np.imag(multipath_tap_1), + np.real(multipath_tap_2), np.imag(multipath_tap_2), + np.real(multipath_taps), np.imag(multipath_taps)))) + +# save to file +location = os.path.realpath(os.path.join(os.getcwd(), os.path.dirname(__file__))) +name, _ = os.path.splitext(os.path.basename(__file__)) +filename = os.path.join(location, name + ".dat") +np.savetxt(filename, data, fmt='%.6e') -- cgit v1.2.1