Skip to content

Instantly share code, notes, and snippets.

@kumanna
Created October 10, 2025 11:18
Show Gist options
  • Select an option

  • Save kumanna/e4860f69b8a018bac6accd024c1de0a4 to your computer and use it in GitHub Desktop.

Select an option

Save kumanna/e4860f69b8a018bac6accd024c1de0a4 to your computer and use it in GitHub Desktop.
import numpy as np
from scipy.linalg import null_space
A_2 = 0.1
t = 0.3
fd1 = 100
fd2 = 120
two_pi_fd1_t = 2 * np.pi * fd1 * t
two_pi_fd2_t = 2 * np.pi * fd2 * t
theta_1 = np.random.rand() * 2 * np.pi
theta_2 = np.random.rand() * 2 * np.pi
fc1 = 2.4e6
fc2 = 2.3e6
delta_f = fc2 - fc1
T1 = (np.sin(two_pi_fd1_t) + A_2 * np.sin(2 * np.pi * (delta_f + fd2) * t + theta_2)) / \
(np.cos(two_pi_fd1_t) + A_2 * np.cos(2 * np.pi * (delta_f + fd2) * t + theta_2))
T2 = (np.sin(2 * np.pi * (fd1 - delta_f) * t + theta_1) + A_2 * np.sin(2 * np.pi * (fd2) * t + theta_2)) / \
(np.cos(2 * np.pi * (fd1 - delta_f) * t + theta_1) + A_2 * np.cos(2 * np.pi * (fd2) * t + theta_2))
s = np.sin(2 * np.pi * delta_f * t)
c = np.cos(2 * np.pi * delta_f * t)
s1 = np.sin(2 * np.pi * fc1 * t)
c1 = np.cos(2 * np.pi * fc1 * t)
s2 = np.sin(2 * np.pi * fc2 * t)
c2 = np.cos(2 * np.pi * fc2 * t)
M = np.array([
[1, -T1, T1 * s + c, -c * T1 + s],
[c - s * T2, -T2 * c - s, 1, -T2],
[-s1, c1, -s2, c2],
])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment