필터 지우기
필터 지우기

How to plot Carrier and Message Signal

조회 수: 27 (최근 30일)
jake stan
jake stan 2018년 4월 2일
답변: Kalpana 2023년 7월 17일
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]);

답변 (2개)

Abraham Boayue
Abraham Boayue 2018년 4월 2일
편집: Abraham Boayue 2018년 4월 2일
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 2023년 7월 17일
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]);

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by