Amplitude modulation & demodulation signal

60 views (last 30 days)
hey there, can anybody help me .. i had run the code but the graph doesnt want to appear..anybody can help me..thank you
t=linspace(0,0.02,10000);
fc=5000;
fm=200;
fs=40000;
Am=5;
Ac=10;
m=(Am/Ac);
wc=(2*pi*fc*t);
wm=(2*pi*fm*t);
ec=(Ac*sin(wc));
em=(Am*sin(wm));
y=(Ac*(l+m*sin(wm).*sin(wc)));
d=(y.*ec);
dl=(conv(d,exp(-t/0.000795)));
l=10000;
subplot(4,1,1),plot(t(1:1),em(1:1))
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('MODULATING SIGNAL');
subplot(4,1,2),plot(t(1:1),ec(1:1))
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('CARRIER SIGNAL');
subplot(4,1,3),plot(t(1:1),ec(1:1))
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('MODULATED SIGNAL');
subplot(4,1,4),plot(t(1:1),ec(1:1))
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('DEMODULATED SIGNAL');
  1 Comment
Ashik Ali
Ashik Ali on 24 Mar 2022
%%
% $$ %% AM Modulation and Demodulation using Functions in MATLAB
%% Modulation index
h= 60;
%% Time Pereiod of Simulation :
t = linspace(0, 0.2, 100000);
%% Message Signal :
Am = 14;
fm = 200;
ym = Am*cos(2*pi*fm*t);
figure;
subplot(4, 1, 1);
plot(t(1:10000), ym(1:10000));
title('Message Signal');
xlabel('time(t)');
ylabel('Amplitude');
%% Carrier Signal :
Ac = Am/h;
fc = 2000;
yc = Ac*cos(2*pi*fc*t);
subplot(4, 1, 2);
plot(t(1:10000), yc(1:10000));
title('Carrier Signal');
xlabel('time(t)');
ylabel('Amplitude');
%% Modulated Signal :
y = ammod(ym, fc, 100000, 0, Ac);
subplot(4, 1, 3);
plot(t(1:10000), y(1:10000));
title('Modulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
%% Demodulated Signal :
z = amdemod(y, fc, 100000, 0, Ac);
subplot(4, 1, 4);
plot(t(1:10000), z(1:10000));
title('Demodulated Signal');
xlabel('time(t)');
ylabel('Amplitude');
ylim([-10, 10]);

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 15 Jul 2020
... the graph doesnt want to appear.
It wants to appear, however you are not letting it!
The (1:1) subscript reference addresses only one point, that being 1, and since the plot function plots between pairs of points, nothing appears. (Note that ‘l’ is in the wrong place in your code. Put it before it is first used.)
Try this:
subplot(4,1,1),plot(t,em)
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('MODULATING SIGNAL');
subplot(4,1,2),plot(t,ec)
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('CARRIER SIGNAL');
subplot(4,1,3),plot(t,ec)
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('MODULATED SIGNAL');
subplot(4,1,4),plot(t,ec)
xlabel('time(sec)');
ylabel('amplitude in volts(V)');
title('DEMODULATED SIGNAL');
You likely copied the plot calls and pasted them to the subplot calls, so you are plotting the same vector the last three times. You might want to check that.

More Answers (2)

LAKSHMI CHAITRA NUNNA
LAKSHMI CHAITRA NUNNA on 16 Apr 2021
%**********AMPLITUDE MODULATION AND DEMODULATION***********%
close all;
clear all;
clc;
fs=8000; %SAMPLE FREQUENCY
fm=20; %THREE MESSAGE SIGNAL FREQUENCY
fc=500; %CARRIER FREQUENCY
Am=1; %MESSAGE AMPLITUDE
Ac=1; %CARRIER AMPLITUDE
t=[0:0.1*fs]/fs; %TIME DURATION
m=Am*cos(2*pi*fm*t);
c=Ac*cos(2*pi*fc*t);
ka=0.5;
u=ka*Am;
s1=Ac*(1+u*cos(2*pi*fm*t)).*cos(2*pi*fc*t);
subplot(4,3,1:3);
plot(t,m);
title('Modulating or Message signal(fm=20Hz)');
subplot(4,3,4:6);
plot(t,c);
title('Carrier signal(fc=500Hz)');
subplot(4,3,7);
plot(t,s1);
title('Under Mod signal');
Am=2;
ka=0.5;
u=ka*Am;
s2=Ac*(1+u*cos(2*pi*fm*t)).*cos(2*pi*fc*t);
subplot(4,3,8);
plot(t,s2);
title('Exact Mod signal');
Am=5;
ka=0.5;
u=ka*Am;
s3=Ac*(1+u*cos(2*pi*fm*t)).*cos(2*pi*fc*t);
subplot(4,3,9);
plot(t,s3);
title('Over Mod signal');
r1=s1.*c;
[b a]=butter(1,0.01); %BUTTERWORTH FILTER
mr1=filter(b,a,r1); %DEPTH OF MODULATION
subplot(4,3,10);
plot(t,mr1);
title('DeModulated signal');
r2=s2.*c;
[b a]=butter(1,0.01);
mr2=filter(b,a,r2);
subplot(4,3,11);
plot(t,mr2);
title('DeModulated signal');
r3=s3.*c;
[b a]=butter(1,0.01);
mr3=filter(b,a,r3);
subplot(4,3,12);
plot(t,mr3);
title('DeModulated signal');

Katkoju Ajay kumar
Katkoju Ajay kumar on 16 Apr 2023
* AM DSBFC Demodulation Circuit
V1 1 0 AC 50mV 50kHz
V2
2 0 AC 80mV 50Hz
M1
3 1 2 0 Multiplier
C1
4 3 1nF
R1
5 4 10k
D1
6 5 Diode
C2
7 6 1nF
R2
8 7 10k
Rload
9 8 1k
Osc
0 Rload
.model Diode D
.tran 0.1ms 200ms
.control
run
plot
V(1), V(2), V(9)
.endc

Community Treasure Hunt

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

Start Hunting!