You are on page 1of 1

clear all;

n=round(10*rand(1));
for i=1:n
a(i)=round(10*rand(1)-1);
a(i)=modulo(a(i), 2);
end
Tb=2e-9;
fs=100/Tb;
t=1/fs:1/fs:Tb;
f1=1/Tb;
f2=2/Tb;
y1=sin(2*3.14*f1*t);
y2=sin(2*3.14*f2*t);
bfsk=zeros(1,n*length(t));
for i=1:n
for j=1:length(t)
if(a(i)==1) then
bfsk((i-1)*length(t)+j)=y1(j);
else
bfsk((i-1)*length(t)+j)=y2(j);
end
nput((i-1)*length(t)+j)=a(i);
end
end
t1=1/fs:1/fs:n*Tb;
figure, subplot(3,1,1); plot(t1,nput);
subplot(3,1,2); plot(t,y1);
subplot(3,1,3); plot(t1,bfsk);

You might also like