Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

MATLAB help needed We wish to transmit the following 20 bits of data, using various modulation schemes: [1 0 0 1 1 1 0 1

MATLAB help needed

We wish to transmit the following 20 bits of data, using various modulation schemes: [1 0 0 1 1 1 0 1 1 0 0 0 0 1 0 1 1 1 0 1]

  1. Using a data rate of 1 bit per second, a carrier of 5 Hz., and a sampling frequency of 50 samples per second, create a MATLAB plot of the OOK modulated signal, along with a plot of the PSD of the signal. Use the functions plot_fft_spectrum and fft_spectrum as a starting point, and modify as necessary.
  2. Repeat for BPSK
  3. Now create an FSK modulation of the same signal, using 4 Hz. and 6 Hz. to represent binary zeros and ones respectively.

Submit the 3 plots. Make sure all axes are labeled properly. Also turn in a short report (1/2 to 1 page long) on what you observe from the plots, particularly the differences in the PSD of the different modulations.

plot_fft_spectrum MATLAB code

unction [f,X] = plot_fft_spectrum(t,x,fignum) %this function calls fft_spectrum to compute the fft of an arbitrary %signal, and plot the magnitude and phase spectrum %It calls the function fft_spectrum to do the computation

%INPUTS %t is the vector of time samples on which x is defined %x is the vector of samples of the function x(t) %fignum is the figure number you wish MATLAB to plot in

%compute the spectrum and the frequency axis values if t(1)==0 %positive time scale [f,X]=fft_spectrum(t,x); else %balanced time scale, so put the t=0 value in the first element [f,X]=fft_spectrum(t,fftshift(x)); end

figure(fignum), clf subplot(3,1,1), plot(t,x,'b','LineWidth',2) title('Time Signal') ylabel('x(t)') xlabel('Time (seconds)') grid on subplot(3,1,2), plot(f,abs(X),'b','LineWidth',2) title('Magnitude Spectrum') ylabel('|X(f)|') xlabel('Frequency (Hz.)') axis([min(f) max(f) 0 1.2*max(abs(X))]) grid on subplot(3,1,3), plot(f,angle(X),'r','LineWidth',2) title('Phase Spectrum') ylabel('\Phi(X(f))') xlabel('Frequency (Hz.)') grid on % subplot(5,1,4), plot(f,real(X),'b') % grid on % subplot(5,1,5), plot(f,imag(X),'r') % grid on

fft_spectrum MATLAB code

function [f,X] = fft_spectrum(t,x) %this function uses the built-in fft to compute the frequency spectrum of a %signal x. It also generates the appropriate frequency scale, f, and %applies the "fftshift" so that X and f vectors are available directly for %plotting.

%the inputs x and t should be vectors of the same length. %the outputs, X and f will also be vectors of that length

%this program is very simple, and will only work if the time axis either starts with 0, or is %balanced positive and negative, with 0 in the center.

%extract the parameters of t vector N=length(x); dt=t(2)-t(1); %create frequency vector df=1/(N*dt); %note the difference between odd length and even length vectors if rem(N,2)==0 %N even f= ( (-N/2):(N/2-1) )*df; else %N odd f= ( (-(N-1)/2):((N-1)/2) )*df; end %find the index of the t=0 element N0=find(t==0);

%do the fft to create the spectrum samples %use proper shifting depending on the time scale and scale amplitude by dt if N0==1 %time scale is nonnegative %X=fftshift(fft(fftshift(x)))*dt; X=fftshift(fft((x)))*dt; elseif rem(N,2)==0 && N0==N/2+1 %time scale is balanced, N is even X=fftshift(fft(x))*dt; elseif rem(N,2)==1 && N0==(N+1)/2 %time scale is balanced, N is odd X=fftshift(fft(x))*dt; else %time scale is unbalanced, so this function won't handle it disp('Unbalanced time scale.') end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DNA Databases

Authors: Stefan Kiesbye

1st Edition

0737758910, 978-0737758917

More Books

Students also viewed these Databases questions

Question

3. Go over a sample question first.

Answered: 1 week ago

Question

3. What are the current trends in computer hardware platforms?

Answered: 1 week ago