Wireless Communications - Exercises 1. Consider the bitstream 101101… . Draw a BPSK waveform that could be used to transmit the bits. Draw an FSK waveform for this bitstream. Compare the bandwidth of these two modulation schemes. 2. Assume in a cellular system that there are 10 channels (or slots) available and that the average use of these slots is 50%. What is the blocking probability of this system? Discuss whether this is a reasonable number. 3. Suppose you have been allocated 79 MHz of bandwidth by the FCC for a wireless system using FDMA with 25 KHz channels not including guard band. For a telephone call with full-duplexing, both an uplink and downlink channel is required. This means that at least 50 KHz would be required per call. If your carrier can drift by 80 Hz, which means that a guard band is required between each channel, how many users can the system support at any one time. Explain your reasoning. 4. Consider the bitstream 101001… . This bitstream can be converted into a waveform by holding the voltage at +1 for T seconds when a 1 appears in the bitstream and then holding the voltage at –1 when a 0 appears. Draw the resulting waveform. Now suppose amplitude modulation is to be used to transmit the bitstream. Draw the modulated signal by using the waveform from the first part in Eq. (6). Show all steps. 5. Assume unit gain transmit and receive antennas, a transmission frequency of 900 MHz, and a transmission power of 1mW. Find the received power in Eq. (2) at a transmitter-receiver separation of 10m, 100m and 1km. Now, assume that the path loss exponent is 4 (you may assume the noise figure is 1). Find the received power in Eq. (3) at a transmitter-receiver separation of 10m, 100m and 1km. Compare the six results. 6. Discuss the advantages and disadvantages of different cell layouts and degrees of frequency use. Consider the performance, the cost, and the societal impact. MATLAB Exercises Project 1 - AM, PM and Signal Bandwidth The goal of this project is to discover the effect of amplitude modulation and phase modulation on the time- and frequency-domain representations of the modulated carrier. Steps: 1. Save the code given below for the first part of the project in a MATLAB directory as proj1a.m, save the second part of the project as proj1b.m 2. Run the first part by typing proj1a 3. Print the resulting plots. 4. Discuss the shape of the time-domain AM and PM signals. Consider where the message is contained, and how it might be extracted from the modulated carrier. 5. Discuss the differences and similarities in the frequency-domain signal, the magnitude spectrum of the modulated carrier. 6. Change the frequency of the message slightly by changing the parameter f0 7. Repeat steps 3-5 comparing the results of the new signal with the previous results. 8. Save the PM signal by typing save PM xpm 9. Run the second project by typing proj1b 10. Print the resulting plot 11. Discuss the resulting bandwidth occupied by the signal. 12. Comment out the lines generating the cosine and uncomment the lines for loading a signal. 13. Replace <filename> with PM or the name of another signal file 14. Run the program and print the resulting plot. 15. Discuss the resulting bandwidth occupied by the signal. Compare this to the results from step 11. 16. Submit all plots and written discussions. % % % % % % % Project 1 Part I - AM and PM Signal Generation Wireless Communications clear % Generate a message which is a sinusoid % First initialize variables % N = number of samples % f0 = cyclical frequency of message signal % T0 = period of the message signal N = 1000; f0 = 10; w0 = 2*pi*f0; T0 = 1/f0; % Generate the message n = 0:1:N-1; t = n*T0/N; x = 0.75*cos(w0*t); figure subplot(711); % % AM SIGNAL GENERATION % % Plot message signal plot(t, x); title('Message signal v(t)'); xlabel('t'); ylabel('v(t)'); % Generate carrier signal fc = 100; wc = 2*pi*fc; Tc = 1/fc; xc = cos(wc*t); % Ac=1 subplot(713); plot(t, xc); title('Carrier signal'); xlabel('t'); ylabel('c(t)'); % Generate AM signal mu = 0.5; xam = (1+mu*x) .* xc; % Plot AM signal subplot(715); plot(t, xam); title('AM signal') xlabel('t'); ylabel('vc(t)'); % Find the spectrum of the AM signal XAM = fft(xam); XAMshift = 1/N*fftshift(XAM); n1 = -500:499; freq_n1 = n1/T0; % Plot the magnitude spectrum of the AM signal at frequencies of interest subplot(717); plot(freq_n1, abs(XAMshift), 'o'); axis([-200 200 0 1]); title('Magnitude spectrum of the AM signal'); xlabel('f'); ylabel('Vc(f)'); % % PM SIGNAL GENERATION % % Plot message signal this is the signal generated above figure subplot(511); plot(t, x); title('Message signal v(t)'); xlabel('t'); ylabel('v(t)'); % Generate PM signal k_p = 3*pi/4; xpm = cos(wc*t + k_p*x); % Plot PM signal subplot(513); plot(t, xpm); title('PM signal') xlabel('t'); ylabel('vc(t)'); % Find spectrum of the PM signal XPM = fft(xpm); XPMshift = 1/N*fftshift(XPM); n2 = -500:499; freq_n2 = n2/T0; % Plot spectrum of the PM signal subplot(515); plot(freq_n2, abs(XPMshift), 'o'); axis([-200 200 0 1]); title('Magnitude spectrum of the PM signal'); xlabel('f'); ylabel('Vc(f)'); % % % % % % % Project 1 Part II - Signal Bandwidth Wireless Communications % % Either load in a previously stored signal or create a new uncomment the appropriate following section. % % % % % % LOAD a signal - uncomment five command lines replace <filename> the name of the stored file it must be in filename.mat (Matlab) form and replace <dataname> with the name of the data. You can use the command “whos” to see the current arrays of data. % For instance, if you use the data from the previous % program you would type % load PM; % w = xpm; % %load <filename>; %w = <dataname>; %N = length(w); %n=0:1:N-1; %To=0.01; % CREATE a new signal - uncomment seven command lines % the signal will be a cosine with variables % N = number of samples % fo = cyclical frequency of sinusoid % wo = angular frequency of sinusoid % To = period of sinusoid N = 50; fo = 10000; wo = 2*pi*fo; To = 1/fo; n = 0:1:N-1; t = n*To/N; w = 4*cos(wo*t); % Find Fast Fourier Transform of the signal W = fft(w); % Convert samples 0,1,...,N-1 into positive and negative Wshift = 1/N*fftshift(W); % Plot signal vs. sample subplot(3,1,1); plot(n,w,'o'); xlabel('Sample Number'); ylabel('Sample Amplitude'); % Plot FFT vs sample subplot(3,1,2); plot(n,abs(Wshift),'o'); xlabel('Sample Number'); ylabel('Magnitude Spectrum'); % Shift the samples so that they are centered at 0 % Scale the axis n1 = -1*round(N/2):1:round(N/2-1); freq_n1= n1/To; if length(freq_n1) > length(Wshift) freq_n1=freq_n1(1:length(Wshift)); end % Plot the transform vs. cyclical frequency subplot(3,1,3); plot(freq_n1,abs(Wshift),'o'); xlabel('Cyclical Frequency (Hz)'); ylabel('Magnitude Spectrum'); Project 2 - Noise in Baseband Signals The goal of this project is to investigate the effect of varying degrees of noise on digital baseband signals. Steps: 1. Save the code given below for the first part of the project in a MATLAB directory as proj2a.m 2. Run the first part by typing proj2a 3. Print the resulting plot. 4. Record the noise standard deviation and the bit error count. 5. Discuss the appearance of the signal with noise as compared to the noise-free signal. 6. Change the noise standard deviation to a value within the permitted range given in the code and re-run the program 7. Record the noise standard deviation and the bit error count. 8. Repeat steps 6 and 7 for at least 10 values of the standard deviation. 9. As the noise standard deviation increases and decreases note the appearance of the noisy signal. Discuss the changes in the signal. 10. Follow the directions in the code for the second part of the project. 11. Print the resulting plot. 12. Discuss the changes in the bit error rate as a function of the noise. 13. Submit all plots and discussions. % % % % % % % Project 2 Part I - Noise in Baseband Signals Wireless Communications % Change this following line to change the standard deviation of the noise, % which will change the noise power. The valid range is [0.01,1]. A large number % indicates more noise stdev=1; % % Create an arbitrary bitstream % bitstream = [1 0 1 1 0 0 1 0 1 0 1 1 0 0 1 0 0 0 0 0 1 1 1 1 0 1 0 1 1 1 1 0 0 0 0 1 0 1 1 0 1 0 1 0 0 0 0 1 0 1 1 0 1 1 0 1 0 1 0 0 1 1 0 0 0 1 1 0 1 1 0 1 01 0 0 1 1 1 1 1 0 0 1 0 1 0 1 0 1 0 0 1 1 1 1 0 0 1 0 1]; % % Generate the baseband signal,v[n], from the above bitstream with pulses % of width 5 and height 1/sqrt(5). % for i=0:99 if bitstream(i+1) == 1 v(i*5+1) = 1; v(i*5+2) = 1; v(i*5+3) = 1; v(i*5+4) = 1; v(i*5+5) = 1; else v(i*5+1) = 0; v(i*5+2) = 0; v(i*5+3) = 0; v(i*5+4) = 0; v(i*5+5) = 0; end end % % plot the NRZ baseband waveform % subplot(3,1,1), plot(v,'o'); axis([0 40 0 1.0]); % % add zero-mean Gaussian noise to the waveform % for i=1:500 y(i) = v(i) + stdev*randn; end; % % plot the noisy waveform % subplot(3,1,2), plot(y,'o'); axis([0 40 -4 4]); % % create an integrate and dump filter with output z(i) % for i=0:99 temp = y(i*5+1) + y(i*5+2)+ y(i*5+3) + y(i*5+4) + y(i*5+5); z(i*5+1) = temp; z(i*5+2) = temp; z(i*5+3) = temp; z(i*5+4) = temp; z(i*5+5) = temp; end % % plot the matched filter output % subplot(3,1,3), plot(z,'o'); axis([0 40 -10 10]); % % sample and determine the number of bit errors % bit_error_count = 0; for i=0:99 if z(i*5+3) > 0.5 temp = 1; else temp = 0; end if bitstream(i+1) ~= temp bit_error_count = bit_error_count +1; end end bit_error_count % Run this program for many choices of the standard deviation and record % the standard deviation and the number of bit errors for each trial % % % % % % % Project 2 Part II - Bit Error Rate Curves Wireless Communications % For each standard deviation compute the signal-to-noise ratio % using the following. Replace stdev with your value and record % the result SNR = 10*log10(1/(stdev^2)); % Now plot the first point with the following three commands % Replace SNR and bit_error_count with the appropriate values semilogy(SNR,bit_error_count,'o'); axis([0 40 0.000001 0.1]); hold; % Now add the other points by repeating the following command % Replace SNR and bit_error_count with the appropriate values semilogy(SNR,bit_error_count,'o'); Project 3 - Number of Users and Blocking Probability The goal of this project is to determine the average amount of traffic, effectively the number of users, which can be served in a cell given a desired grade of service and a number of available channels. Steps: 1. Save the code given below for the auxiliary function in a MATLAB directory as ErlangB.m, save the code for the project as proj3.m 2. Run the program by typing proj3 3. Record the capacity 4. Change the number of channels, the parameter channels, to a number between 2 and 100. 5. Repeat steps 2 through 4 for 10 channel values. 6. Change the desired grade of service, the parameter desired_GOS, to a value between 0.1 and 0.0001 7. Repeat steps 2 through 6 four times. 8. Discuss the results. Consider the tradeoffs in desired grade of service and the number of users in the system. 9. Submit the discussion. % % % % % % % Project 3 - Auxiliary function Number of Users and Blocking Probability Wireless Communications function [diff] = ErlangB(A,C,GOS) sumA = 0; for i=0:C sumA=sumA+(A^i/factorial(i)); end GOS1 = (A^C/factorial(C))/sumA; diff=GOS-GOS1; % % % % % % % Project 3 Main Routine Number of Users and Blocking Probability Wireless Communications % Change the following two parameters and plot the number of % users, the capacity, as a function of desired_GOS for a % selected number of channels channels = 10; desired_GOS = 0.01; init_capacity=channels*4/5; options=optimset; capacity=fsolve('ErlangB',init_capacity,options,channels,desired_GOS)