- 'butter function' : https://www.mathworks.com/help/signal/ref/butter.html
- 'filtfilt function' : https://www.mathworks.com/help/signal/ref/filtfilt.html
- 'pwelch function' : https://www.mathworks.com/help/signal/ref/pwelch.html
Generate magnitude and phase spectra of the modulated and demodulated signal using power spectral density using MATLAB.
8 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (1)
Ayush
le 4 Mar 2024
Modifié(e) : Ayush
le 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:
0 commentaires
Voir également
Catégories
En savoir plus sur Spectral Estimation dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!