SlideShare a Scribd company logo
% MATLAB Script for a Binary ASK with two Amplitude Levels 
format long; 
% Clear all variables and close all figures 
clear all; 
close all; 
% The number of bits to send - Frame Length 
N = 8; 
% Generate a random bit stream 
bit_stream = round(rand(1,N)); 
% Enter the two Amplitudes 
% Amplitude for 0 bit 
A1 = 3; 
% Amplitude for 1 bit 
A2 = 5; 
% Frequency of Modulating Signal 
f = 3; 
% Sampling rate - This will define the resoultion 
fs = 100; 
% Time for one bit 
t = 0: 1/fs : 1; 
% This time variable is just for plot 
time = []; 
ASK_signal = []; 
Digital_signal = []; 
for ii = 1: 1: length(bit_stream) 
% The FSK Signal 
ASK_signal = [ASK_signal (bit_stream(ii)==0)*A1*sin(2*pi*f*t)+... 
(bit_stream(ii)==1)*A2*sin(2*pi*f*t)]; 
% The Original Digital Signal 
Digital_signal = [Digital_signal (bit_stream(ii)==0)*...
zeros(1,length(t)) + (bit_stream(ii)==1)*ones(1,length(t))]; 
time = [time t]; 
t = t + 1; 
end 
% Plot the ASK Signal 
subplot(2,1,1); 
plot(time,ASK_signal,'LineWidth',2); 
xlabel('Time (bit period)'); 
ylabel('Amplitude'); 
title('ASK Signal with two Amplitudes'); 
%axis([0 time(end) 1.5 1.5]); 
grid on; 
% Plot the Original Digital Signal 
subplot(2,1,2); 
plot(time,Digital_signal,'r','LineWidth',2); 
xlabel('Time (bit period)'); 
ylabel('Amplitude'); 
title('Original Digital Signal'); 
axis([0 time(end) -0.5 1.5]); 
grid on;
% MATLAB Script for a Binary FSK with two Amplitude Levels 
clear; 
clc; 
b = input('Enter the Bit stream n '); 
%b = [0 1 0 1 1 1 0]; 
n = length(b); 
t = 0:.01:n; 
x = 1:1:(n+1)*100; 
for i = 1:n 
if (b(i) == 0) 
b_p(i) = -1; 
else 
b_p(i) = 1; 
end 
for j = i:.1:i+1 
bw(x(i*100:(i+1)*100)) = b_p(i); 
end 
end 
bw = bw(100:end); 
wo = 2*(2*pi*t); 
W = 1*(2*pi*t); 
sinHt = sin(wo+W); 
sinLt = sin(wo-W); 
st = sin(wo+(bw).*W); 
subplot(4,1,1) 
plot(t,bw) 
grid on ; axis([0 n -2 +2]) 
subplot(4,1,2) 
plot(t,sinHt) 
grid on ; axis([0 n -2 +2]) 
subplot(4,1,3) 
plot(t,sinLt) 
grid on ; axis([0 n -2 +2]) 
subplot(4,1,4) 
plot(t,st) 
grid on ; axis([0 n -2 +2]) 
Fs=1; 
figure 
%pburg(st,10) 
periodogram(st)
% MATLAB Script for a Binary PSK with two Amplitude Levels 
clear all; %Clear all variables 
close all; %Close all figures 
l=1e6; %Number of bits or symbols 
EbNodB=0:2:10; %Range of EbNo in dB 
for n=1:length(EbNodB); 
s=2*(round(rand(1,l))-0.5); %Random symbol generation 
w=(1/sqrt(2*10^(EbNodB(n)/10)))*randn(1,l); %Random noise generation 
r=s+w; %Received signal 
s_est=sign(r); %Demodulation 
BER(n)=(l-sum(s==s_est))/l; %BER calculation 
end 
semilogy(EbNodB, BER,'o-'); %Plot 
xlabel('EbNo(dB)') %Label for x-axis 
ylabel('BER') %Label for y-axis 
grid on

More Related Content

PDF
Agilent ADS 模擬手冊 [實習2] 放大器設計
DOC
Industrial training report of vlsi,vhdl and pcb designing
PDF
Verilog coding of demux 8 x1
PDF
Verilog coding of mux 8 x1
PDF
VHDL- gate level modelling
PDF
Concepts of Behavioral modelling in Verilog HDL
PDF
Vlsi design notes
PDF
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬
Agilent ADS 模擬手冊 [實習2] 放大器設計
Industrial training report of vlsi,vhdl and pcb designing
Verilog coding of demux 8 x1
Verilog coding of mux 8 x1
VHDL- gate level modelling
Concepts of Behavioral modelling in Verilog HDL
Vlsi design notes
射頻電子實驗手冊 [實驗1 ~ 5] ADS入門, 傳輸線模擬, 直流模擬, 暫態模擬, 交流模擬

What's hot (20)

PDF
射頻電子 - [第五章] 射頻放大器設計
PDF
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬
PDF
Communication systems solution manual 5th edition
PDF
1st Semester M Tech CMOS VLSI Design (Dec-2013) Question Papers
PDF
射頻電子 - [第六章] 低雜訊放大器設計
PPT
Switch level modeling
PPTX
Flip flops
PPT
Introduction to VLSI
PPT
Sequential Logic Circuit
PPTX
Presentation on Scaling
PDF
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬
PPTX
Control system basics, block diagram and signal flow graph
PPTX
MOSFET and Short channel effects
PPTX
Comparison between the FPGA vs CPLD
PDF
RF Circuit Design - [Ch1-1] Sinusoidal Steady-state Analysis
PPTX
CMOS Inverter static characterstics.pptx
PDF
RF Circuit Design - [Ch4-1] Microwave Transistor Amplifier
PPTX
Layout & Stick Diagram Design Rules
PPT
VLSI Physical Design Automation.ppt
PDF
射頻電子 - [第三章] 史密斯圖與阻抗匹配
射頻電子 - [第五章] 射頻放大器設計
射頻電子實驗手冊 - [實驗7] 射頻放大器模擬
Communication systems solution manual 5th edition
1st Semester M Tech CMOS VLSI Design (Dec-2013) Question Papers
射頻電子 - [第六章] 低雜訊放大器設計
Switch level modeling
Flip flops
Introduction to VLSI
Sequential Logic Circuit
Presentation on Scaling
射頻電子實驗手冊 - [實驗8] 低雜訊放大器模擬
Control system basics, block diagram and signal flow graph
MOSFET and Short channel effects
Comparison between the FPGA vs CPLD
RF Circuit Design - [Ch1-1] Sinusoidal Steady-state Analysis
CMOS Inverter static characterstics.pptx
RF Circuit Design - [Ch4-1] Microwave Transistor Amplifier
Layout & Stick Diagram Design Rules
VLSI Physical Design Automation.ppt
射頻電子 - [第三章] 史密斯圖與阻抗匹配
Ad

Viewers also liked (8)

PPTX
Digital modulation techniques updated
PPTX
Psk, qam, fsk different modulation
PDF
Pseudo Random Number Generators
PPTX
Amplitude shift keying
PDF
ASK,FSK and M-PSK using Matlab
PPTX
Modulation techniques
PPSX
Amplitude shift keying (ask)
Digital modulation techniques updated
Psk, qam, fsk different modulation
Pseudo Random Number Generators
Amplitude shift keying
ASK,FSK and M-PSK using Matlab
Modulation techniques
Amplitude shift keying (ask)
Ad

Similar to bask, bfsk, bpsk (20)

PDF
Matlab fair-record-model
PDF
Experiment3_DCS-21BEC0384Adityabonnerjee
TXT
Demodulate bpsk up
TXT
Demodulation bpsk up
PDF
Modulation techniques matlab_code
DOC
Digitla Communication pulse shaping filter
PDF
Comm lab manual_final
PDF
Comm lab manual_final-1
DOCX
Fourier series example
PDF
Matlab kod taslağı
PDF
Matlab 2
PPTX
Matlab Homework Help
PDF
Digital signal Processing all matlab code with Lab report
PPTX
final matlabمتعدل.pptxggggffyhhggghhhggggh
PDF
Exam 6 commlab 18_119_ei0292
DOCX
FM Frequency Modulation Codes Matlab.docx
PPT
Unit 3 - Styles of Modeling-1 for resource management techniques
PPTX
Signal and image processing on satellite communication using MATLAB
PDF
Dsp lab manual
DOCX
Implementasi FIR filter menggunakan matlab
Matlab fair-record-model
Experiment3_DCS-21BEC0384Adityabonnerjee
Demodulate bpsk up
Demodulation bpsk up
Modulation techniques matlab_code
Digitla Communication pulse shaping filter
Comm lab manual_final
Comm lab manual_final-1
Fourier series example
Matlab kod taslağı
Matlab 2
Matlab Homework Help
Digital signal Processing all matlab code with Lab report
final matlabمتعدل.pptxggggffyhhggghhhggggh
Exam 6 commlab 18_119_ei0292
FM Frequency Modulation Codes Matlab.docx
Unit 3 - Styles of Modeling-1 for resource management techniques
Signal and image processing on satellite communication using MATLAB
Dsp lab manual
Implementasi FIR filter menggunakan matlab

Recently uploaded (20)

PPTX
Fundamentals of safety and accident prevention -final (1).pptx
PDF
Well-logging-methods_new................
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PPTX
Current and future trends in Computer Vision.pptx
PPT
Project quality management in manufacturing
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Safety Seminar civil to be ensured for safe working.
Fundamentals of safety and accident prevention -final (1).pptx
Well-logging-methods_new................
Internet of Things (IOT) - A guide to understanding
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
CYBER-CRIMES AND SECURITY A guide to understanding
Current and future trends in Computer Vision.pptx
Project quality management in manufacturing
III.4.1.2_The_Space_Environment.p pdffdf
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
R24 SURVEYING LAB MANUAL for civil enggi
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
null (2) bgfbg bfgb bfgb fbfg bfbgf b.pdf
additive manufacturing of ss316l using mig welding
Safety Seminar civil to be ensured for safe working.

bask, bfsk, bpsk

  • 1. % MATLAB Script for a Binary ASK with two Amplitude Levels format long; % Clear all variables and close all figures clear all; close all; % The number of bits to send - Frame Length N = 8; % Generate a random bit stream bit_stream = round(rand(1,N)); % Enter the two Amplitudes % Amplitude for 0 bit A1 = 3; % Amplitude for 1 bit A2 = 5; % Frequency of Modulating Signal f = 3; % Sampling rate - This will define the resoultion fs = 100; % Time for one bit t = 0: 1/fs : 1; % This time variable is just for plot time = []; ASK_signal = []; Digital_signal = []; for ii = 1: 1: length(bit_stream) % The FSK Signal ASK_signal = [ASK_signal (bit_stream(ii)==0)*A1*sin(2*pi*f*t)+... (bit_stream(ii)==1)*A2*sin(2*pi*f*t)]; % The Original Digital Signal Digital_signal = [Digital_signal (bit_stream(ii)==0)*...
  • 2. zeros(1,length(t)) + (bit_stream(ii)==1)*ones(1,length(t))]; time = [time t]; t = t + 1; end % Plot the ASK Signal subplot(2,1,1); plot(time,ASK_signal,'LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('ASK Signal with two Amplitudes'); %axis([0 time(end) 1.5 1.5]); grid on; % Plot the Original Digital Signal subplot(2,1,2); plot(time,Digital_signal,'r','LineWidth',2); xlabel('Time (bit period)'); ylabel('Amplitude'); title('Original Digital Signal'); axis([0 time(end) -0.5 1.5]); grid on;
  • 3. % MATLAB Script for a Binary FSK with two Amplitude Levels clear; clc; b = input('Enter the Bit stream n '); %b = [0 1 0 1 1 1 0]; n = length(b); t = 0:.01:n; x = 1:1:(n+1)*100; for i = 1:n if (b(i) == 0) b_p(i) = -1; else b_p(i) = 1; end for j = i:.1:i+1 bw(x(i*100:(i+1)*100)) = b_p(i); end end bw = bw(100:end); wo = 2*(2*pi*t); W = 1*(2*pi*t); sinHt = sin(wo+W); sinLt = sin(wo-W); st = sin(wo+(bw).*W); subplot(4,1,1) plot(t,bw) grid on ; axis([0 n -2 +2]) subplot(4,1,2) plot(t,sinHt) grid on ; axis([0 n -2 +2]) subplot(4,1,3) plot(t,sinLt) grid on ; axis([0 n -2 +2]) subplot(4,1,4) plot(t,st) grid on ; axis([0 n -2 +2]) Fs=1; figure %pburg(st,10) periodogram(st)
  • 4. % MATLAB Script for a Binary PSK with two Amplitude Levels clear all; %Clear all variables close all; %Close all figures l=1e6; %Number of bits or symbols EbNodB=0:2:10; %Range of EbNo in dB for n=1:length(EbNodB); s=2*(round(rand(1,l))-0.5); %Random symbol generation w=(1/sqrt(2*10^(EbNodB(n)/10)))*randn(1,l); %Random noise generation r=s+w; %Received signal s_est=sign(r); %Demodulation BER(n)=(l-sum(s==s_est))/l; %BER calculation end semilogy(EbNodB, BER,'o-'); %Plot xlabel('EbNo(dB)') %Label for x-axis ylabel('BER') %Label for y-axis grid on