Question

matlab help, please

An FSK signal is the concatenation of sinusoidal tones of two possible frequencies, 1650 Hz and 1850 Hz. There is no silenceA plot of signal xx is shown in Figure 5.6. In the middle of the plot, xi does not change smoothly to xo. This happens becaus5.3.2 FSK signal for character values An FSK modem is used in a digital communication system to transmit binary zeros and oneMATLAB has some useful functions for performing ASCII conversion and converting decimal numbers into bits. Check the online hmy code is here:

%% exercise2
%a
Fs = 8000; % sampling frequency
tn = 0:1/Fs:0.005; % here, bit duration is 0.005s instead of 1/300s
phi1 = 0; phi0 = 0; % phases of the sinusoid
x1 = cos(2*pi*1650*tn + phi1); % tone for binary 1
x0 = cos(2*pi*1850*tn + phi0); % tone for binary 0
xx = [x1, x0]; % FSK signal for ¡°1,0¡±
tt = [tn, tn + 0.005]; % time
figure(1)
plot(tt, xx); % plot FSK signal
%% b
a= abs('DSP');
b = dec2bin(a,8);
c = b- '0';
Fs = 8000; % sampling frequency
tn = 0:1/Fs:0.005; % here, bit duration is 0.005s instead of 1/300s
phi1 = 0; phi0 = 0; % phases of the sinusoid
x1 = cos(2*pi*1650*tn + phi1); % tone for binary 1
x0 = cos(2*pi*1850*tn + phi0); % tone for binary 0
B = [c(1,:), c(2,:),c(3,:)];
X = [];
for i= 1:length(B)
if B(i)==1
X = [X,x1];
elseif B(i)==0
X = [X,x0];
end
end
T=[];
for i=0:length(B)-1
T=[T,tn+0.005*i];
end
figure(2)
plot(T,X)

Is it correct?

An FSK signal is the concatenation of sinusoidal tones of two possible frequencies, 1650 Hz and 1850 Hz. There is no silence in between the tones. The following MATLAB code generates an FSK signal for binary sequence '10': Fs-8000; % sampling frequency 0:1/Fs : 0 , 005; % here, bit duration is 0.005s instead of 1/300s tn = phil-0 phio0; x1 _ cos (2*pi*1650*tn :0-cos (2*pi*1850*tn % phases of the sinusoid % tone for binary 1 % tone for binary 0 phil); phi 0); + + % FSK signal for "1,0" tt = [tn, tn + 0.005]; % time plot (tt, xx); % plot FSK signal A plot of signal xx is shown in Figure 5.6. In the middle of the plot, x1 does not change smoothly to x0. This happens because the "phase" the concatenated signal is discontinuous at the transition point. In other words, x1 of 1650 Hz has not yet completed a full cycle when xo of 1850 Hz begins. We could make the concatenated signal smoother by choosing a different value for phi0. Verify that phi0provides a smoother transition from x1 to x0
A plot of signal xx is shown in Figure 5.6. In the middle of the plot, xi does not change smoothly to xo. This happens because the "phase" the concatenated signal is discontinuous at the transition point. In other words, x1 of 1650 Hz has not yet completed a full cycle when xo of 1850 Hz begins. We could make the concatenated signal smoother by choosing a different value for phi0. Verify that phio provides a smoother transition from x1 to x0 0.8 0.6 0.4 o 0.2 -0.2 0.4 -0.6 0.8 0 0.001 0.002 0.003 0.004 0.005 0.006 0.007 0.008 0.009 0.01 Time (s) Figure 5.6: An FSK signal for bit sequence '10'.
5.3.2 FSK signal for character values An FSK modem is used in a digital communication system to transmit binary zeros and ones. To transmit messages in an alphabet, we need a binary representation for each character in the alphabet. A standard for punctuation. For example, the upper-case character 'A' is represented by ASCII code of 65d or 01000001b lower-case character'с, is represented by ASCII code of 99d Or 0110001 1b. Therefore, if we want to encode a message, such as 'Hello World', for the FSK modem, we must turn the eleven characters of the message into O's and 1's. Since blanks are counted as characters, we would have 88 bits.
MATLAB has some useful functions for performing ASCII conversion and converting decimal numbers into bits. Check the online help for the following functions: % convert decimal integer to a binary string create character array (string) dec2bin char bin2dec % convert binary string to decimal integer Enter the following MATLAB commands and observe the outputs: a-abs ("Hello World) % get the ASCII codes for 'Hello world' b-dee2bin(a, 8) % get the 8-bit string from ASCII codes 8 get a matrix of binary value (0, 1) Exercise 2: Suppose that message DSP s to be transmitted as an FSK signal. a) Find the ASCII codes for the message. b) Find the binary sequence for the message. c) Find and plot the FSK signal for the message.
1 0
Add a comment Improve this question Transcribed image text
Answer #1

Fs = 8000; % sampling frequency
tn = 0:1/Fs:0.005; % here, bit duration is 0.005s instead of 1/300s
phi1 = 0; phi0 = 0; % phases of the sinusoid
x1 = cos(2*pi*1650*tn + phi1); % tone for binary 1
x0 = cos(2*pi*1850*tn + phi0); % tone for binary 0
xx = [x1, x0]; % FSK signal for ¡°1,0¡±
tt = [tn, tn + 0.005]; % time
figure(1)
plot(tt, xx); % plot FSK signal
%% b
a= abs('DSP');
b = dec2bin(a,8);
c = b- '0';
Fs = 8000; % sampling frequency
tn = 0:1/Fs:0.005; % here, bit duration is 0.005s instead of 1/300s
phi1 = 0; phi0 = 0; % phases of the sinusoid
x1 = cos(2*pi*1650*tn + phi1); % tone for binary 1
x0 = cos(2*pi*1850*tn + phi0); % tone for binary 0
B = [c(1,:), c(2,:),c(3,:)];
X = [];
for i= 1:length(B)
if B(i)==1
X = [X,x1];
elseif B(i)==0
X = [X,x0];
end
end
T=[];
for i=0:length(B)-1
T=[T,tn+0.005*i];
end
figure(2)
plot(T,X)

Is it correct?

Yes, your code is correct. And the best thing is that you have commented your code so,it's a good practice to carry on.

Add a comment
Know the answer?
Add Answer to:
matlab help, please my code is here: %% exercise2 %a Fs = 8000; % sampling frequency tn = 0:1/Fs:0.005; % here, bit dura...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts...

    Program from problem 1: (Using MATLAB) % Sampling frequency and sampling period fs = 10000; ts = 1/fs; % Number of samples, assume 1000 samples l = 1000; t = 0:1:l-1; t = t.*ts; % Convert the sample index into time for generation and plotting of signal % Frequency and amplitude of the sensor f1 = 110; a1 = 1.0; % Frequency and amplitude of the power grid noise f2 = 60; a2 = 0.7; % Generating the sinusoidal waves...

  • Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2...

    Can you please help me answer Task 2.b? Please show all work. fs=44100; no_pts=8192; t=([0:no_pts-1]')/fs; y1=sin(2*pi*1000*t); figure; plot(t,y1); xlabel('t (second)') ylabel('y(t)') axis([0,.004,-1.2,1.2]) % constrain axis so you can actually see the wave sound(y1,fs); % play sound using windows driver. %% % Check the frequency domain signal. fr is the frequency vector and f1 is the magnitude of F{y1}. fr=([0:no_pts-1]')/no_pts*fs; %in Hz fr=fr(1:no_pts/2); % single-sided spectrum f1=abs(fft(y1)); % compute fft f1=f1(1:no_pts/2)/fs; %% % F is the continuous time Fourier. (See derivation...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT