Filter löschen
Filter löschen

What is the difference between demod and ammod?

8 Ansichten (letzte 30 Tage)
Saif Bashar
Saif Bashar am 28 Dez. 2022
Beantwortet: Kunal Kandhari am 17 Jan. 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);
figure("Name","Problem");
subplot(5,1,1);
plot(t(1:10000),ym(1:10000));
grid on;
title("Massage Signal");
% Generate Carrier Signal
yc = Ac * cos(2*pi*Fc*t);
subplot(5,1,2);
plot(t(1:10000),yc(1:10000));
title("Carrier Signal");
% Generate Modulated Signal
y = modulate(ym,Fc,100000,"am");
subplot(5,1,3);
plot(t(1:10000),y(1:10000));
title("Modulated Signal");
% Demodulation Signal
yd1 = demod(y,Fc,100000);
yd = amdemod(y,Fc,100000);
subplot(5,1,4);
plot(t(1:10000),yd(1:10000));
title("Demodulated Signal(Ammod)");
ylim([-10 10]);
subplot(5,1,5);
plot(t(1:10000),yd1(1:10000));
title("Demodulated Signal(Modulate)")

Antworten (1)

Kunal Kandhari
Kunal Kandhari am 17 Jan. 2023
Hi,
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:

Kategorien

Mehr zu PHY Components finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by