amplitude_modulation.m
· 542 B · Mathematica
Raw
clc;
clear all;
close all;
fs = 1000;
t = 0:0.0001:0.1;
Am = 1;
Ac = 2;
fm = 50;
fc = 500;
Ka = 0.5;
% Modulating signal
msg = Am * cos(2 * pi * fm * t);
% Carrier signal
carr = Ac * cos(2 * pi * fc * t);
% AM Wave
amw = Ac * (Ka * msg) .* cos(2 * pi * fc * t);
% Plotting
subplot(3,1,1);
plot(t, msg);
xlabel('t');
ylabel('m(t)');
title('Modulating Signal');
subplot(3,1,2);
plot(t, carr);
xlabel('t');
ylabel('c(t)');
title('Carrier Signal');
subplot(3,1,3);
plot(t, amw);
xlabel('t');
ylabel('amw(t)');
title('Modulated Signal');
| 1 | clc; |
| 2 | clear all; |
| 3 | close all; |
| 4 | |
| 5 | fs = 1000; |
| 6 | t = 0:0.0001:0.1; |
| 7 | |
| 8 | Am = 1; |
| 9 | Ac = 2; |
| 10 | |
| 11 | fm = 50; |
| 12 | fc = 500; |
| 13 | |
| 14 | Ka = 0.5; |
| 15 | |
| 16 | % Modulating signal |
| 17 | msg = Am * cos(2 * pi * fm * t); |
| 18 | |
| 19 | % Carrier signal |
| 20 | carr = Ac * cos(2 * pi * fc * t); |
| 21 | |
| 22 | % AM Wave |
| 23 | amw = Ac * (Ka * msg) .* cos(2 * pi * fc * t); |
| 24 | |
| 25 | % Plotting |
| 26 | subplot(3,1,1); |
| 27 | plot(t, msg); |
| 28 | xlabel('t'); |
| 29 | ylabel('m(t)'); |
| 30 | title('Modulating Signal'); |
| 31 | |
| 32 | subplot(3,1,2); |
| 33 | plot(t, carr); |
| 34 | xlabel('t'); |
| 35 | ylabel('c(t)'); |
| 36 | title('Carrier Signal'); |
| 37 | |
| 38 | subplot(3,1,3); |
| 39 | plot(t, amw); |
| 40 | xlabel('t'); |
| 41 | ylabel('amw(t)'); |
| 42 | title('Modulated Signal'); |