Azzera filtri
Azzera filtri

How to plot Carrier and Message Signal

66 visualizzazioni (ultimi 30 giorni)
jake stan
jake stan il 2 Apr 2018
Risposto: Kalpana il 17 Lug 2023
The first picture is the equation for carrier signal and the 2nd one is the message signal.
The ampltitudes for both (Ac and Am are 1), and the frequency for the carrier (fc) is given by the user, whereas the frequency for the message (fm) is 0.02.
However, I'm unsure in how to plot these two signals on top of each other. Am I doing the interval for the fplot correctly?
fc = input('carrier frequency')
fm = 0.02 %Hz
Ac = 1;
Am = 1;
Ta = 1/fc; %period for carrier
Tc = 1/fm;
m = @(t) Am*cos(2*pi*fm*t);
S = @(t) Ac*cos(2*pi*fc*t);
subplot(3, 1 ,1);
fplot(S, [0 Ta]);
subplot(3, 1, 2);
fplot(m, [0 Tc]);

Risposte (2)

Abraham Boayue
Abraham Boayue il 2 Apr 2018
Modificato: Abraham Boayue il 2 Apr 2018
Try something like this :
clear variables
close all
fc = input('carrier frequency')
fm = 4 %Hz
Ac = 1;
Am = 1;
Ta = 1/fc; %period for carrier
Tc = 1/fm;
N = 200;
t0 = -2;
t1 = 2;
t = t0:(t1-t0)/(N-1):t1;
m = Am*cos(2*pi*fm*t);
S = Ac*cos(2*pi*fc*t);
plot(t,S,'linewidth',2,'color','r')
hold on
plot(t,m,'linewidth',2,'color','b')
legend('S(t)','M(t)')
a= title('Carrier and Message Signals');
set(a,'fontsize',14);
a= xlabel('t [-2\pi 2\pi]');
set(a,'fontsize',20);
a = ylabel('y');
set(a,'fontsize',20);
a = zlabel('z');
set(a,'fontsize',20);
grid
grid minor

Kalpana
Kalpana il 17 Lug 2023
fc = input('carrier frequency')
fm = 0.02 %Hz
Ac = 1;
Am = 1;
Ta = 1/fc; %period for carrier
Tc = 1/fm;
m = @(t) Am*cos(2*pi*fm*t);
S = @(t) Ac*cos(2*pi*fc*t);
subplot(3, 1 ,1);
fplot(S, [0 Ta]);
subplot(3, 1, 2);
fplot(m, [0 Tc]);

Categorie

Scopri di più su Programming in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by