MATLAB code for Double side band suppressed carrier

Aim: Write MATLAB code to get the DSB-SC Amplitude Modulation 

Requirements: PC with MATLAB software

Program:

clc;
clear all;
close all;
fc=100000;
fs=1000000;
f=1000;
m=0.5;
a=1/m;
opt=-a;
t=0:1/fs:((2/f)-(1/fs));
x=cos(2*pi*f*t);
y=modulate(x,fc,fs,'amdsb-tc',opt);
subplot(3,1,1);
plot(x);
title('modulating signal');
subplot(3,1,2);
plot(y);
title('modulated dsb-sc signal');
x_recov=demod(y,fc,fs,'amdsb-tc',opt);
subplot(3,1,3);
plot(x_recov);
title('original signal')

Output: