matlab_assign_soln_1 - ECE 561 – Digital Communications...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ECE 561 – Digital Communications Systems Solution to MATLAB Assignment #1 1. a. >> t=0:.01:3-.01; >> x=cos(2*pi*t)+5*cos(4*pi*t); >> plot(t,x) b. >> power=sum(x.^2)/length(x) power = 13.0000 c. >> X=fft(x); >> fs=1/.01; >> deltaf=fs/length(x); >> N=length(x); >> plot([-N/2+1:N/2]*deltaf,(1/N)*abs(fftshift(X))) or expanding the frequency scale: d. >> plot([-N/2+1:N/2]*deltaf,((1/N)*abs(fftshift(X))).^2) e. >> sum(((1/N)*abs(fftshift(X))).^2) ans = 13.0000 f. >> x_autocorr=ifft(((1/N)*abs((X))).^2); >> plot(t,length(x)*x_autocorr) g. >> x2_auto=12.5*cos(4*pi*t)+.5*cos(2*pi*t); >> plot(t,x2_auto) h. >> length(x)*x_autocorr(1) ans = 13.0000 Note that this is the signal power. 2. The model window: Select a sampling time of 0.2 (fs = 5) and run the simulation for 51.2 seconds. This will result in 256 samples (the length the FFT is set to). 3. To display out to 5KHz, the sampling frequency needs to be 10KHz, or a sampling interval of .1mS. For a resolution of 2 Hz, 2 = 10K/N or N=5000. The smallest power of 2 greater than 5000 is 8192. Thus, the sample time of the rate transition block is set to .1E‐3 and the stop time on the simulation is set to (1E‐3)*8192. The FFT is set to be of length 8192. The first null bandwidth is 1KHz. 4. ...
View Full Document

This document was uploaded on 02/27/2010.

Ask a homework question - tutors are online