Generate magnitude and phase spectra of the modulated and demodulated signal using power spectral density using MATLAB.

8 views (last 30 days)
Using MATLAB:
Given: message signal: 3cos(100*t) and carrier: 6cos(4000**t) generate magnitude and phase spectra of the modulated and demodulated signal using power spectral density for double sideband-SC.

Answers (1)

Ayush
Ayush on 4 Mar 2024
Edited: Ayush on 4 Mar 2024
Hi,
It seems you want to generate magnitude and phase spectra of the modulated and demodulated signal using power spectral density for double sideband-SC. There will be four basic steps. First, initialize your message and carrier signal. The second would be to modulate the signal. The third is to demodulate the modulated signal to retrieve the original message signal. Finally, Compute and plot the Power Spectral Density (PSD) for the modulated and demodulated signals to observe the magnitude and phase spectra.
Refer to an example code below for a better understanding:
% Define parameters
Fs = 20000; % Sampling frequency, high enough to satisfy Nyquist
T = 1/Fs; % Sampling period
L = 1000; % Length of the signal
t = (0:L-1)*T; % Time vector
% Message signal
Am = 3; % Amplitude of the message signal
fm = 100; % Frequency of the message signal
message = Am*cos(pi*fm*t);
% Carrier signal
Ac = 6; % Amplitude of the carrier signal
fc = 4000; % Frequency of the carrier signal
carrier = Ac*cos(pi*fc*t);
% DSB-SC Modulation
modulated_signal = message .* carrier;
% DSB-SC Demodulation
demodulated_signal = modulated_signal .* (2*carrier);
% Low-pass filter (simple implementation)
[b, a] = butter(6, 0.01); % 6th order Butterworth, cutoff frequency adjusted as needed
demodulated_filtered = filtfilt(b, a, demodulated_signal);
% PSD of the modulated signal
figure;
pwelch(modulated_signal,[],[],[],Fs);
title('PSD of Modulated Signal');
% PSD of the demodulated signal
figure;
pwelch(demodulated_filtered,[],[],[],Fs);
title('PSD of Demodulated Signal');
The code uses the 'Butterworth filter' to get transfer function coefficients of an nth-order filter and the 'filtfilt' function to perform zero-phase digital filtering. You can make changes in the parameters to improve the output as per the requirement. The 'pwelch' function is also used to get the power spectral density (PSD) estimate. Refer to the below documentation for more information:

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!