communication system porject

profileassassinood
project1_student.m

%--------------------------------% % ECE 499 : Project 1 % %--------------------------------% % Clear workspace and screen. Close all figures clear all; close all; clc %---------------------------------% % Generate sampled 5000Hz Carrier % %---------------------------------% num_samples = 10000; total_time = .1; sampling_period = total_time / num_samples; sampling_frequency = 1 / sampling_period time = linspace( 0, total_time, num_samples ); carrier_freq = 5000; carrier = cos( 2 * pi * carrier_freq * time ); % Plot a portion of carrier. figure plot( time(1000:3000), carrier(1000:3000) ); grid xlabel('t') ylabel('c(t)') title('Carrier (5000Hz)') axis([0.01 0.03 -2 2]) % Plot carrier spectrum/PSD figure periodogram( carrier, [], num_samples, sampling_frequency ); title('Power Spectral Density of Carrier'); axis([0 10 -150 0]) %----------------------------------------% % Generate message bandlimited to 500 Hz % %----------------------------------------% % Generate a 1xn array comprised of random values using randn.m (signal % without any band limitation). Note that, you may use the 'seed' option % to reproduce the same random values if desired (optional). % Plot a portion of the obtained result (signal without any band limitation) % vs. time. % Generate LPF % %--------------% % Design an FIR equiriple LPF (with a 500Hz Cut-off frequency) using fdatool.m % Frequency Specifications: Units: Hz % Fs = sampling_frequency = 1e5 % Fpass = 500 Hz % Fstop = 550 Hz % Magnitude specification: Units: Linear % Dpass = 0.1 % Dstop = 0.001 % Density factor = 20 % export impulse reponse as 'lpf' % save lpf lpf % Plot impulse response of LPF vs. sample indices (n) % Plot LPF specrrum/PSD (effective frequency response) % Implement LPF = process signal without any band limitation using LPF % (use conv2 with 'same' option) to obtain band limited message (original % message) % Plot a portion of band limited message (original message) % Plot spectrum/PSD of band limited message (orginal message) %-------------------------------------------------------------------% % Perform AM Modulation : Singla Side Band - Large Carrier (SSB-LC) % %-------------------------------------------------------------------% % Peform AM modulation (Double Side Band - Suppressed Carrier = DSB-SC) % Plot a portion of the modulated carrier (AM signal = DSB-SC) and the corresponding % portion of the orginal message (band limited message) superimposed on the same plot vs. time % Plot spectrum/PSD of modulated carrier (AM signal = DSB-SC) % Generate BPF % %--------------% %Generate an FIR equiripple Band Pass Filter using fdatool.m (with a Low Cut off at 5000 Hz %and a High Cut off at 6000Hz : centered at 5500 ) %Frequency Specifications: Units: Hz %Fs = sampling_frequency = 1e5 %Fstop1 = 4900 %Fpass1 = 5000 %Fpass2 = 6000 %Fstop2 = 6100 % Magnitude specification: Units: Linear %Dstop1 = 0.001 %Dpass = .1 %Dstop2 = 0.001 %Export as 'bpf' %save bpf bpf %load bpf % Plot impulse response of BPF vs. sample indices (n) % Plot spectrum/PSD (effectice continuous frequency response) of BPF % process the DSB-SC modulated carrier (AM signal) using BPF = Filtering % to Single Side Band - Suppressed-Carrier (SSB-SC) % Plot a portion of the SSB-SC signal and the corresponding portion of the % original message superimposed on the same plot vs. time. % Plot spectrum/PSD of SSB-SC signal % generate Single Sideband Band - Large Carrier (SSB-LC) signal % Plot a portion of the SSB-LC and the correspdonding portion of the % orginal message superimposed on the same plot vs. time % (note that you will need to add a DC offset to +1 the orginal message % for comparison purposes) %-------------------------------% % Perform coherent demodulation % %-------------------------------% % Perform demodulation (received signal) % Implement LPF: process received signal using LPF (demodulated signal) % Plot a portion of the demodulated signal with the appropriate scaling factor and % the correspdoning portion of the orginal message superimposed on the same plot vs. time %(Note that you will need to add a DC offset to the orginal message for comparison purposes) %-------------------% % Error Computation % %-------------------% % Plot a portion of the error function % Find the mean and std of a portion of the error funcion