MATLAB FSK Encoder One of the simplest modems is FSK (V.21) which works by sendi
ID: 3582301 • Letter: M
Question
MATLAB
FSK Encoder One of the simplest modems is FSK (V.21) which works by sending a 1650-Hz tone for binary 1 and a 1850-Hz tone for binary 0. The symbol interval is 1/300 second. At the beginning of every symbol interval the cosine wave being synthesized can conceivably have its frequency changed from 1650 to 1850 Hz (or vice versa), the phase however should be smooth at the boundary to avoid a jump (also referred to as phase reversal). Write a complete FSK encoding system that will take a text message and produce the correct sequence of sinusoidal signals as would be generated in an FSK modem. The message has to be converted from text characters to a stream of bits. In addition, the standard preamble bits must be placed at the beginning of the bit stream, and 16 ones must be placed at the end to indicate termination of the message. Give the MATLAB code for your encoding function. Make the bit rate one of the inputs to the encoder. Then encode the message "SP First" at 50 bps, and then show part of the spectrogram (with a window length of 128) to illustrate that the encoder is functioning properly.Explanation / Answer
Answer:
clc %for clearing the command window
close all %for closing all the window except command window
clear all %for deleting all the variables from the memory
fc1=input('Enter the freq of 1st Sine Wave carrier:');
fc2=input('Enter the freq of 2nd Sine Wave carrier:');
fp=input('Enter the freq of Periodic Binary pulse (Message):');
amp=input('Enter the amplitude (For Both Carrier & Binary Pulse Message):');
amp=amp/2;
t=0:0.001:1; % For setting the sampling interval
c1=amp.*sin(2*pi*fc1*t);% For Generating 1st Carrier Sine wave
c2=amp.*sin(2*pi*fc2*t);% For Generating 2nd Carrier Sine wave
subplot(4,1,1); %For Plotting The Carrier wave
plot(t,c1)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 1 Wave')
subplot(4,1,2) %For Plotting The Carrier wave
plot(t,c2)
xlabel('Time')
ylabel('Amplitude')
title('Carrier 2 Wave')
m=amp.*square(2*pi*fp*t)+amp;%For Generating Square wave message
subplot(4,1,3) %For Plotting The Square Binary Pulse (Message)
plot(t,m)
xlabel('Time')
ylabel('Amplitude')
title('Binary Message Pulses')
for i=0:1000 %here we are generating the modulated wave
if m(i+1)==0
mm(i+1)=c2(i+1);
else
mm(i+1)=c1(i+1);
end
end
subplot(4,1,4) %For Plotting The Modulated wave
plot(t,mm)
xlabel('Time')
ylabel('Amplitude')
title('Modulated Wave')
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.