Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

One part of the FSK encoder must take a bit stream and create a sinusoid for eac

ID: 2072416 • Letter: O

Question

One part of the FSK encoder must take a bit stream and create a sinusoid for each bit. The bits per second (bps) will determine the duration of each sinusoid. For example, 300 bits/second (bps) requires a duration of 1/300 sec. In this part, you must complete the function below and use it to generate a FSK signal. function fk = fsk_gen(bitstr, bps, Fs) %FSK-GEN generate the FSK sinusoids at 1650 and 1850 Hz %1650 encodes a "1", 1850 encodes a "0" % %bitstr = STRING of zeros and ones. %bps = bits per second %Fs = sampling rate %fk = synthesized FSK signal put your code here

Explanation / Answer

MATLAB code

function fk=fsk_gen(bitstr, bps, Fs)

% 1650 encodes '1' and 1850 encodes '0'
% Fs sampling frequency
% bps bits per sec
% Synthesized FSK signal
% bitstr string of '0' s and '1' s

f1=1650;
f2=1850;
t=0:1/Fs:(1/bps-(1/Fs));
x1=sin(2*pi*f1*t);
x2=sin(2*pi*f2*t);

for i=1:length(bitstr)
if(bitstr(i)==1)
out1=x1;
else
out1=x2;
end
if (i==1)
yk=out1;
else
yk=[yk out1];
end
end
fk=yk;

end