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

9 次查看(过去 30 天)
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.

回答(1 个)

Ayush
Ayush 2024-3-4
编辑:Ayush 2024-3-4
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:

类别

Help CenterFile Exchange 中查找有关 Spectral Estimation 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by