# Vestigal side band matlab code

125 views (last 30 days)
ong jia eek on 19 Oct 2019
Answered: MD Rasel Basunia on 8 Apr 2022
%>>>>>>>>>>>>>>>>>>>> Tuterial on AM vestigial sideband Modulation <<<<<<<<<<<<<<<<<<<<<<<<<<
clc;
close all;
clear all;
%XXXXXXXXXXXXXXXXXXXXXXXXXXX Define AM modulation Index XXXXXXXXXXXXXXXXXXX
disp(' example: m=1 means 100% modulation');
m=input(' Enter the value of modulation index (m) = ');
%m=1; % for 100% modulation
if (0>m||m>1)
error('m may be less than or equal to one and greater0 than to zero');
end
%XXXXXXXXXXXXXXXXX modulating signal generation XXXXXXXXXXXXXXXXXXXXXXXXXX
Am =input('Enter the value of amplitude modulation =');
n=input('Enter number of cycles = '); % input for number of modulationd signal cycles
%Am=5; % Amplitude of modulating signal
fa=2000; % Frequency of modulating signal
Ta=1/fa; % Time period of modulating signal
t=0:Ta/999:n*Ta; % Total time for simulation
ym=Am*sin(2*pi*fa*t); % Equation of modulating signal
figure(1)
subplot(3,1,1);
plot(t,ym), grid on;% Graphical representation of Modulating signal
%axis ([0 1 -5 5]);
title ( ' Modulating Signal ');
xlabel ( ' time(sec) ');
ylabel (' Amplitud(volt) ');
%XXXXXXXXXXXXXXXXXXXXX carrier signal generation XXXXXXXXXXXXXXXXXXXXXXXXXX
Ac=Am/m;% Amplitude of carrier signal [ where, modulation Index (m)=Am/Ac ]
fc=fa*10;% Frequency of carrier signal
Tc=1/fc;% Time period of carrier signal
yc=Ac*sin(2*pi*fc*t);% Eqation of carrier signal
subplot(3,1,2);
plot(t,yc), grid on;% Graphical representation of carrier signal
title ( ' Carrier Signal ');
xlabel ( ' time(sec) ');
ylabel (' Amplitud(volt) ');
%XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX AM Modulation XXXXXXXXXXXXXXXXXXXXXXXXXXXXX
y=Ac*(1+m*sin(2*pi*fa*t)).*sin(2*pi*fc*t)(; % Equation of Amplitude
%modulated signal
subplot(3,1,3);
plot(t,y);% Graphical representation of AM signal
title ( ' Amplitude Modulated signal ');
xlabel ( ' time(sec) ');
ylabel (' Amplitud(volt) ');
grid on;
%>>>>>>>>>>>>>>>>>>>>>> end of program <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
How to change this matlab code to vestigial side band?
How can we put frequency code here?
dhanvanth voona on 21 May 2021
this is only amplitude modulation, we need to design appropriate filters and apply them to message signals to obtain VSB

MD Rasel Basunia on 8 Apr 2022
%% message signal m(t)=u(t+2)-u(t-2)
syms t f
fc=10;%let carrier frequency frequency contain 10 Hz .x_carrier=cos(2*pi*10*t)
x = heaviside(t+2)- heaviside(t-2) %% Fourier transform of m(t)
X=fourier(x,f) ;% fourier transform
%% using anonymous function
XX = @(f) 2*(sin(2*f)./(f))
f=[-100:0.01:100-0.01];% proper frequency range .Avoiding 0 / 0.
%% Generation of DSB-SC
Xshift=( XX(f-fc)+XX(f+fc));
%% Designing VSB shaping filter characteristic
% Define normalized VSB shaping filter
Hf = @(f) ((f>=9 & f<=20)) ;
%% Generating SSB
SSB =@(f) Xshift.*(f>=10 & f<=50) + Xshift.*(f<=-10 & f>=-50);
%%Here I am just plotting SSB-SC and VSB modulation signals.you can also
%%plot Hf(f) characteristic normalized filter and DSB-SC from equation.
%% Generation of VSB
VSB_upper = @(f)((XX(f-fm)+XX(f+fm)).*Hf(f)) %SSB(f).*Hf(f)SB_upper = @(f)((XX(f-fm)+XX(f+fm)).*Hf(f)) %SSB(f).*Hf(f)
subplot(211)
%% ploting SSB
plot(f,abs(SSB(f)),[-10,-10],[0,4],[10 10],[0,4],'r','linewidth',1.5);
% set axis for visualize porpuse only
xlim([-35 35]);
grid on;ylim([0 6]);xlabel('frequency in Hz');ylabel('Magnitude spectrum');
legend('| SSB-SC|');
title('Single Sideband Modulation');
%% ploting VSB
subplot(212)
plot(f,abs(VSB_upper(f)),'b',-f,abs(VSB_upper(f)),'k','linewidth',1.5);grid on;
xlabel('frequency in Hz');ylabel('Magnitude spectrum');
title('SSB');ylim([0 6]);legend('| VSB |');
% set axis for visualize purpose
xlim([-35 35]);
% see carefully around 10 Hz .A vestige was found before +10 Hz and also in
% case negative -10 Hz

### Categories

Find more on Periodic Waveform Generation in Help Center and File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by