0% found this document useful (0 votes)
8 views4 pages

DSB SC

NA

Uploaded by

rbtemp1149
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

DSB SC

NA

Uploaded by

rbtemp1149
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

dsb-sc

October 28, 2024

[1]: import numpy as np


import matplotlib.pyplot as plt
from scipy import signal

[61]: #setting parameters


Ac=1
Am=1
fm=10
fc=100
fs=1000
t=np.arange(0,1,1/fs)

[62]: #message signal


message=Am*(np.cos(2*np.pi*fm*t))
#carrier signal
carrier=Ac*(np.cos(2*np.pi*fc*t))
#frequency axis
freq=np.fft.fftfreq(len(t),1/fs)
#message fourier transform
fft_message=np.fft.fft(message)
#carrier fourier transform
fft_carrier=np.fft.fft(carrier)

#Because of symmetry taking only positive spectrum


fft_positive_message=fft_message[:int(len(fft_message)/2)]/max(fft_message)␣
↪#normalizing the amplitude

fft_positive_carrier=fft_carrier[:int(len(fft_carrier)/2)]/max(fft_carrier)␣
↪#normalizing the amplitude

positive_freq=freq[:int(len(freq)/2)]

[63]: #plotting message and carrier


plt.figure(figsize=(12,6))
plt.subplot(2,2,1)
plt.plot(t,message,color="red")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.title("Message Signal")

1
plt.subplot(2,2,2)
plt.plot(t,carrier,color="blue")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.title("Carrier Signal")
plt.subplot(2,2,3)
plt.plot(positive_freq,np.abs(fft_positive_message),color="red")
plt.xlabel("Frequency")
plt.ylabel("Amplitude")
plt.title("Fourier Transform of Message Signal")
plt.subplot(2,2,4)
plt.plot(positive_freq,np.abs(fft_positive_carrier),color="blue")
plt.xlabel("Frequency")
plt.ylabel("Amplitude")
plt.title("Fourier Transform of Carrier Signal")
plt.tight_layout()
plt.show()

[98]: #dsc-sc modulation


dsb_sc_mod=message*carrier
fft_dsb_sc=np.fft.fft(dsb_sc_mod)

#Because of symmetry taking only positive spectrum


fft_positive_dsb_sc=fft_dsb_sc[:int(len(fft_dsb_sc)/2)]/max(fft_dsb_sc)

plt.figure(figsize=(12,5))
plt.subplot(2,1,1)
plt.plot(t,dsb_sc_mod,color="purple")

2
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.title("DSB-SC Modulated Signal")
plt.subplot(2,1,2)
plt.plot(positive_freq,np.abs(fft_positive_dsb_sc),color="brown")
plt.xlabel("Frequency")
plt.ylabel("Amplitude")
plt.title("Fourier Transform of DSB-SC Modulated Signal")
plt.tight_layout()
plt.show()

[91]: def demodulation(mod_signal,cutt_off,fs,n,type):


b,a=signal.butter(n,cutt_off,btype=type,fs=fs)
w, h = signal.freqs(b, a)
demod_signal=signal.filtfilt(b,a,mod_signal)
return w,h,demod_signal

[99]: w,h,demod_dsb_sc=demodulation(dsb_sc_mod*carrier,fm,fs,7,"low")
plt.figure(figsize=(10,10))
plt.subplot(2,1,1)
plt.plot(t,demod_dsb_sc,color="red")
plt.xlabel("Time")
plt.ylabel("Amplitude")
plt.title("Demodulated signal")

[99]: Text(0.5, 1.0, 'Demodulated signal')

3
4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy