0% found this document useful (0 votes)
22 views3 pages

Code

ASK code

Uploaded by

Kanij Fatema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Code

ASK code

Uploaded by

Kanij Fatema
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

clear all;

close all;
clc;
x=[1 0 0 1 1 0 1];
bp=.000001;
disp('binary information at transmitter:');
disp(x);
bit=[];
for n=1:1:length(x)
if x(n)==1;
se=ones(1,100);
else x(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t1=bp/100:bp/100:100*length(x)*(bp/100);
subplot(3,1,1);
plot(t1,bit,'linewidth',2.5);
grid on;
axis ([ 0 bp*length(x) -.5 1.5]);
ylabel('amplitude(volt)');
xlabel('time(sec)');
title('transmitting information as digital signal');
A1=10;
A2=5;
br=1/bp;
f=br*10;
t2=bp/99:bp/99:bp;
ss=length(t2);
m=[];
for (i=1:1:length(x))
if (x(i)==1)
y=A1*cos(2*pi*f*t2);
else
y=A2*cos(2*pi*f*t2);
end
m=[m y];
end
t3=bp/99:bp/99:bp*length(x);
subplot(3,1,2);
plot(t3,m);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('waveform for binary ASK modulation corresponding
binary information');
mn=[];
for n=ss:ss:length(m)
t=bp/99:bp/99:bp;
y=cos(2*pi*f*t);
mm=y.*m((n-(ss-1)):n);
t4=bp/99:bp/99:bp;
z=trapz(t4,mm);
zz=round((2*z/bp))
if(zz>7.5)
a=1;
else
a=0;
end
mn=[mn a];
end
disp('Binary information at receiver:');
disp(mn);
bit=[];
for n=1:length(mn);
if mn(n)==1;
se=ones(1,100);
else
mn(n)==0;
se=zeros(1,100);
end
bit=[bit se];
end
t4=bp/100:bp/100:100*length(mn)*(bp/100);
subplot(3,1,3);
plot(t4,bit,'linewidth',2.5);
grid on;
axis([ 0 bp*length(mn) -.5 1.5]);
xlabel('time(sec)');
ylabel('amplitude(volt)');
title('Received information as digital signal after binary
ASK demodulation');

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy