フィルターのクリア

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 Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by