MATLAB: I need to plot the amplitude of the signals

aliasingnyquist ratesampling theorem

I don't know what I did wrong:
%variables
Am=5; %message signal amplitude

Ac=10; %message signal amplitude
t=0:0.001:1; %period
Fm=50; %message frequency
Fc=1000; %carrier frequency
%output graph preparation
m=Am*cos(2*pi*Fm*t); %signal equation
c=Ac*cos(2*pi*Fc*t); %carrier equation
%plot m(t) and its amplitude
figure;
plot(t,m);
xlabel('time');
ylabel('m(t)');
figure;
plot(t,abs(m));
xlabel('time');
ylabel('m(t)');
title('amplitude');
%plot c(t) and its amplitude
figure;
plot(t,c);
xlabel('time');
ylabel('c(t)');
figure;
plot(t,abs(c));
xlabel('time');
ylabel('c(t)');
title('amplitude');
%Sketch the magnitude of the multiplication of m(t) with c(t).
y=m.*c;
figure;
plot(t,y);
xlabel('time');
ylabel('y(t)');
figure
plot(t,abs(y));
xlabel('time');
ylabel('y(t)');
title('amplitude');

Best Answer

Try not using so many elements - too many to display.
Try this:
clc;
close all;
clear;
workspace;
format long g;
format compact;
fontSize = 15;
%variables
Am=5; %message signal amplitude

Ac=10; %message signal amplitude
t= linspace(0, 0.04, 1500); %period
Fm=50; %message frequency
Fc=1000; %carrier frequency
%output graph preparation
m=Am*cos(2*pi*Fm*t); % Signal equation
c=Ac*cos(2*pi*Fc*t); % Carrier equation
%plot m(t) and its amplitude
subplot(2,3,1);
plot(t,m);
xlabel('time', 'FontSize', fontSize);
ylabel('m(t)', 'FontSize', fontSize);
title('Signal Equation', 'FontSize', fontSize);
% Put x axis in the right place.



ax = gca
ax.XAxisLocation = 'origin'
subplot(2,3,2);
plot(t,abs(m));
xlabel('time', 'FontSize', fontSize);
ylabel('m(t)', 'FontSize', fontSize);
title('Signal Amplitude', 'FontSize', fontSize);
%plot c(t) and its amplitude
subplot(2,3,3);
plot(t,c);
xlabel('time', 'FontSize', fontSize);
ylabel('c(t)', 'FontSize', fontSize);
title('Carrier Equation', 'FontSize', fontSize);
% Put x axis in the right place.
ax = gca
ax.XAxisLocation = 'origin'
subplot(2,3,4);
plot(t,abs(c));
xlabel('time', 'FontSize', fontSize);
ylabel('c(t)', 'FontSize', fontSize);
title('Carrier Amplitude', 'FontSize', fontSize);
% Put x axis in the right place.
ax = gca
ax.XAxisLocation = 'origin'
%Sketch the magnitude of the multiplication of m(t) with c(t).
y=m.*c;
subplot(2,3,5);
plot(t,y);
xlabel('time', 'FontSize', fontSize);
ylabel('m(t) .* c(t)', 'FontSize', fontSize);
title('Multiplication of m(t) with c(t)', 'FontSize', fontSize);
% Put x axis in the right place.
ax = gca
ax.XAxisLocation = 'origin'
subplot(2,3,6);
plot(t,abs(y));
xlabel('time', 'FontSize', fontSize);
ylabel('y(t)', 'FontSize', fontSize);
title('Amplitude of the multiplication', 'FontSize', fontSize);
% Set up figure properties:
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'OuterPosition', [0 0 1 1]);
% Get rid of tool bar and pulldown menus that are along top of figure.
set(gcf, 'Toolbar', 'none', 'Menu', 'none');
% Give a name to the title bar.
set(gcf, 'Name', 'Demo by ImageAnalyst', 'NumberTitle', 'Off')