Finished ECOMMS homework 3

This commit is contained in:
Aidan Sharpe 2024-11-11 19:15:36 -05:00
parent 660744cf30
commit 655a0ecfde
6 changed files with 43 additions and 17 deletions

View File

@ -90,6 +90,4 @@ Frequency: 1kHz
### 3c ### 3c
If the RF waveform appears across a 50$\Omega$ load, determine the average power and the PEP. If the RF waveform appears across a 50$\Omega$ load, determine the average power and the PEP.
The average power of the signal is: The average power and the PEP are the same: $\frac{A_c^2}{2} \times \frac{1}{50} = 2.5$kW.
$$\langle s^2(t) \rangle = \frac{1}{T} \int\limits_{-T/2}^{T/2} 500\cos(\omega_c t + 20\cos(\omega_1 t)) dt$$

View File

@ -0,0 +1,36 @@
import numpy as np
import scipy as sp
import matplotlib.pyplot as plt
f_c = 100E+6
f_m = 1E3
T_c = 1/f_c
f_s = 1E9
T_s = 1/f_s
A_c = 500
D_p = 100
D_f = 1E+6
omega_m = 2*np.pi*f_m
omega_c = 2*np.pi*f_c
# Time samples to 10 seconds at a samplig frequency of 8kHz
t = np.arange(0,10*T_c,T_s)
m_p = 0.2*np.cos(omega_m * t)
m_f = -2E-5*omega_m*np.sin(omega_m * t)
M_f = 2E-5*np.cos(omega_m*t)
theta = D_f * M_f
# The phase modulated signal
s_p = A_c*np.cos(omega_c*t + D_p*m_p)
s_f = A_c*np.cos(omega_c*t + theta)
c = A_c*np.cos(omega_c *t)
plt.plot(t, s_p, label="Phase Modulated Signal")
plt.plot(t, s_p-c)
#plt.plot(t, s_f, label="Frequency Modulated Signal")
plt.show()

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -2,10 +2,9 @@ import numpy as np
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import scipy as sp import scipy as sp
f_s = 8E3 f_s = 10
T_s = 1/f_s T_s = 1/f_s
t = np.arange(-5,5,T_s) t = np.arange(0,1+T_s,T_s)
f = np.linspace(0,f_s,len(t)) f = np.linspace(0,f_s,len(t))
omega = 2*np.pi*f omega = 2*np.pi*f
@ -18,16 +17,9 @@ w = u(t) - u(t-0.6) + u(t-0.7) - u(t-1)
W_c = 1j*(np.exp(-1j*omega*0.6) + np.exp(-1j*omega) - np.exp(-1j*omega*0.7) - 1)/omega W_c = 1j*(np.exp(-1j*omega*0.6) + np.exp(-1j*omega) - np.exp(-1j*omega*0.7) - 1)/omega
W_d = sp.fft.fft(w) W_d = sp.fft.fft(w)
print(W_c[:10]) plt.stem(f, W_d)
print(W_d[:10]) plt.xlabel("Frequency (Hz)")
plt.plot(t,w)
plt.show() plt.show()
plt.bar(t, sp.fft.ifft(W_d), T_s, align='edge')
plt.xlabel("Time (s)")
plt.subplot(211)
plt.plot(W_c)
plt.subplot(212)
plt.plot(W_d)
plt.show() plt.show()

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB