What is the difference between demod and ammod?

5 visualizzazioni (ultimi 30 giorni)
Saif Bashar
Saif Bashar il 28 Dic 2022
Risposto: Kunal Kandhari il 17 Gen 2023
I want to modulate a massage signal then demodulate that signal.
When i use demod then the demodulated signal is different than actual signal , but when i use ammod it works perfectly. what is the difference between those two?
My full code:
% clear all the work space
clc;clear all;close all;
% Get user input
% h = input("Enter the modulation index:"); % 1
% Am = input("Enter the massage amplitude:"); % 10
% Fm = input("Enter the massage frequency:"); % 200
h = 1;
Am = 10;
Fm = 200;
% Set Carrier frequency and amplitude based on modulation index
Ac = Am/h;
Fc = Fm*10;
% Define time
t = linspace(0,0.2,100000);
% Generate massage signal
ym = Am * cos(2*pi*t*Fm);
grid on;
title("Massage Signal");
% Generate Carrier Signal
yc = Ac * cos(2*pi*Fc*t);
title("Carrier Signal");
% Generate Modulated Signal
y = modulate(ym,Fc,100000,"am");
title("Modulated Signal");
% Demodulation Signal
yd1 = demod(y,Fc,100000);
yd = amdemod(y,Fc,100000);
title("Demodulated Signal(Ammod)");
ylim([-10 10]);
title("Demodulated Signal(Modulate)")

Risposte (1)

Kunal Kandhari
Kunal Kandhari il 17 Gen 2023
demod(y,fc,fs,method) demodulates the real carrier signal y with a carrier frequency fc and sample rate fs using the method specified in method. By default it is: am i.e., Amplitude demodulation
Whereas amdemod(y,Fc,Fs) returns a demodulated signal z, given the input amplitude modulated (AM) signal y, where the carrier signal has frequency Fc. The carrier signal and y have sampling frequency Fs. The modulated signal y has zero initial phase and zero carrier amplitude, resulting from a suppressed-carrier modulation.
You can read more about both of this functions from the following documentation:

Community Treasure Hunt

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

Start Hunting!

Translated by