What is the difference between demod and ammod?

조회 수: 4 (최근 30일)
Saif Bashar
Saif Bashar 2022년 12월 28일
답변: Kunal Kandhari 2023년 1월 17일
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)")

답변 (1개)

Kunal Kandhari
Kunal Kandhari 2023년 1월 17일
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:

카테고리

Help CenterFile Exchange에서 PHY Components에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by