# DSB-AM, SSB-AM and VSB-AM signal Matlab Code

Here it is shown how to write Matlab Code to plot DSB-AM, SSB-AM and VSB-AM signals in Matlab. Matlab is a powerful high level language which you can use to test your mathematical equations. In this tutorial it is shown how one can use Matlab to generate AM signal with Matlab. This helps you to understand how mathematical equation works and how calculation is performed.

### Double Sideband Amplitude Modulation(DSB-AM)

Here is an example of how you can generate an Double Sideband Amplitude Modulation(DSB-AM) signal in MATLAB:

% Define the parameters of the signal
carrier_frequency = 1000; % carrier frequency in Hz
modulation_index = 0.5; % modulation index
modulating_frequency = 100; % modulating frequency in Hz
sampling_frequency = 10000; % sampling frequency in Hz
time = 0:1/sampling_frequency:1; % time vector

% Generate the carrier signal
carrier_signal = cos(2*pi*carrier_frequency*time);

% Generate the modulating signal
modulating_signal = cos(2*pi*modulating_frequency*time);

% Generate the AM signal
AM_signal = (1 + modulation_index*modulating_signal).*carrier_signal;

% Plot the signals
plot(time, carrier_signal, 'r');
hold on;
plot(time, modulating_signal, 'g');
hold on;
plot(time, AM_signal, 'b');
legend('carrier', 'modulating', 'AM');
xlabel('Time (s)');
ylabel('Amplitude');


The following code generates a sinusoidal carrier signal at a frequency of 1000 Hz, a sinusoidal modulating signal at a frequency of 100 Hz, and an AM signal by multiplying the carrier signal with the modulating signal multiplied by the modulation index. The resulting DSB-AM signal is then plotted in blue.

You can adjust the parameters (carrier_frequency, modulation_index, modulating_frequency, and sampling_frequency) to suit your needs.

Also, it is important to note that this is an example of the simplest form of Amplitude Modulation called Double Sideband Amplitude Modulation(DSB-AM) which is not practical in real-world applications. But you can use other forms of AM which includes Single Sideband(SSB-AM) and Vestigial Sideband(VSB-AM) with appropriate filtering. For actual implementation see am modulator circuit.

### Single Sideband(SSB-AM)

Here is an example of how you can generate a single-sideband amplitude modulated (SSB-AM) signal in MATLAB:

% Define the parameters of the signal
carrier_frequency = 1000; % carrier frequency in Hz
modulation_index = 0.5; % modulation index
modulating_frequency = 100; % modulating frequency in Hz
sampling_frequency = 10000; % sampling frequency in Hz
time = 0:1/sampling_frequency:1; % time vector

% Generate the carrier signal
carrier_signal = cos(2*pi*carrier_frequency*time);

% Generate the modulating signal
modulating_signal = cos(2*pi*modulating_frequency*time);

% Generate the DSB-AM signal
DSB_AM_signal = (1 + modulation_index*modulating_signal).*carrier_signal;

% Generate the SSB-AM signal (Upper sideband)
SSB_AM_signal = DSB_AM_signal.*cos(2*pi*carrier_frequency*time);

% Plot the signals
plot(time, SSB_AM_signal, 'b');
legend('SSB-AM');
xlabel('Time (s)');
ylabel('Amplitude');


This code generates a sinusoidal carrier signal at a frequency of 1000 Hz, a sinusoidal modulating signal at a frequency of 100 Hz, a Double-Sideband Amplitude Modulation (DSB-AM) signal and then generates an upper SSB-AM signal by multiplying the DSB-AM signal with a carrier signal at the same frequency as the DSB-AM carrier frequency. The resulting Single Sideband Amplitude Modulated(SSB-AM) signal is then plotted in blue.

You can adjust the parameters (carrier_frequency, modulation_index, modulating_frequency, and sampling_frequency) to suit your needs.

For lower sideband generation, you can multiply DSB-AM signal with the sine of the carrier frequency instead of cosine. A simple way in practice to build DSB-AM signal generator is to use diode based

It is important to note that the SSB-AM signal is bandpass filtered to remove one of the sidebands generated by DSB-AM. In practice, this filtering is performed at the transmitter and receiver using a filter called a "product detector" to generate SSB-AM signals.

### Vestigial Sideband(VSB-AM)

Here is an example of how you can generate a vestigial sideband amplitude modulated (VSB-AM) signal in MATLAB:

% Define the parameters of the signal
carrier_frequency = 1000; % carrier frequency in Hz
modulation_index = 0.5; % modulation index
modulating_frequency = 100; % modulating frequency in Hz
sampling_frequency = 10000; % sampling frequency in Hz
time = 0:1/sampling_frequency:1; % time vector

% Generate the carrier signal
carrier_signal = cos(2*pi*carrier_frequency*time);

% Generate the modulating signal
modulating_signal = cos(2*pi*modulating_frequency*time);

% Generate the DSB-AM signal
DSB_AM_signal = (1 + modulation_index*modulating_signal).*carrier_signal;

% Generate the VSB-AM signal
VSB_AM_signal = filter(ones(1,11)/11,1,DSB_AM_signal);

% Plot the signals
plot(time, VSB_AM_signal, 'b');
legend('VSB-AM');
xlabel('Time (s)');
ylabel('Amplitude');


This code generates a sinusoidal carrier signal at a frequency of 1000 Hz, a sinusoidal modulating signal at a frequency of 100 Hz, a Double-Sideband Amplitude Modulation (DSB-AM) signal and then generates a VSB-AM signal by applying a low-pass filter on the DSB-AM signal. The resulting Vestigial Sideband Amplitude Modulated(VSB-AM) signal is then plotted in blue.

Again, you can adjust the parameters (carrier_frequency, modulation_index, modulating_frequency, and sampling_frequency) to suit your requirement.

It is important to note that the VSB-AM signal is band-limited to remove one of the sidebands generated by DSB-AM. In practice, this filtering is performed at the transmitter and receiver using a filter called a "raised cosine filter" to generate VSB-AM signals.

So here it was shown how to write Matlab Code to plot DSB-AM, SSB-AM and VSB-AM signals in Matlab.