How to plot Carrier and Message Signal
27 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171742/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/171743/image.png)
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]);
0 comentarios
Respuestas (2)
Abraham Boayue
el 2 de Abr. de 2018
Editada: Abraham Boayue
el 2 de Abr. de 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
0 comentarios
Kalpana
el 17 de Jul. de 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]);
0 comentarios
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!