Question
Need help answering the following questions. The MATLAB code for solving the questions is below. : Discuss a comparison of the PSD for the three
Need help answering the following questions. The MATLAB code for solving the questions is below. :
- Discuss a comparison of the PSD for the three pulse shapes (figure 2). In particular note the width of the main lobe and the height of the side lobes. This is how we evaluate
- Discuss a comparison of the PSD for the three pulse shapes (figure 2). In particular note the width of the main lobe and the height of the side lobes. This is how we evaluate the spectral efficiency of a digital modulation scheme.
- Compare the PSD diagrams from Figure 2 and figure 5. Explain the similarities and differences.
- Study figure 3 and figure 4. What do you conclude?
- Re-run the program using a beta value of 1 for the raised cosine filter. What differences does it make in figures 1 through 5?
- the spectral efficiency of a digital modulation scheme.
- Compare the PSD diagrams from Figure 2 and figure 5. Explain the similarities and differences.
- Study figure 3 and figure 4. What do you conclude?
- Re-run the program using a beta value of 1 for the raised cosine filter. What differences does it make in figures 1 through 5?
MATLAB Code
function pulse_psd_examples
%set up time scale fs=1000; %sampling frequency ts=1/fs; %sampling time tmin=-4; tmax=4; t=tmin:ts:tmax; %time scale L=length(t); % number of time samples NFFT = 2^14; %length of fft (make big enough to easily accomodate Rx) %frequency scale for spectrum plot f=fs*(-NFFT/2:NFFT/2-1)/NFFT;
%construct the time signal here T=2; %width of pulse Toffset=0; %delay of pulse
%rectangular pulse x=rectpuls(t-Toffset,T); %x=rectpuls((t-Toffset)/T);
%triangular pulse %x=tripuls(t-Toffset,T);
%Manchester pulse % x = rectpuls(t-T/4-Toffset,T/2) - rectpuls(t+T/4-Toffset,T/2);
%Gaussian pulse % sigma=T/4; % x = (1/(sqrt(2*pi)*sigma))*exp(-(t-Toffset).^2/(2*sigma^2));
%sinc pulse %x=sinc(t/(T/2)-Toffset);
%Raised Cosine pulse % span=6; %number of cycles % beta = 0.5; %roll-off factor % rcshape = rcosdesign(beta,span,fs*T,'normal')*sqrt(fs*T); % x=zeros(size(t)); % x(find(t==-span/2+Toffset) : find(t==span/2+Toffset))=rcshape;
%Modulate the pulse % fc=5; % x=x.*cos(2*pi*fc*t);
%noise burst %x = x .*randn(size(x));
%do equivalent of an 'fftshift' and pad in the middle to gain freq. res. xpad = [x(t>=0) zeros(1,NFFT-L) x(t<0)]; %fourier transform of x X=fftshift(fft(xpad))*ts;
%autocorrelation of x Rx = xcorr(x,x)*ts; %time scale to accomodate non-centered time offset pulses tRx=(2*tmin:ts:2*tmax)+Toffset;
%power spectral density of the signal from X Pxx = X.*conj(X);
%psd from the autocorrelation Sx=abs(fftshift(fft(Rx,NFFT)))*ts; fr=fs*(-NFFT/2:NFFT/2-1)/NFFT;
%============ plotting ======================= figure(1); clf; orient landscape subplot(2,2,1), plot(t,x,'b','LineWidth',2); title('Time Signal x(t)') xlabel('Time (sec.)') ylabel('Amplitude') axis([min(t) max(t) -2*max(x) 2*max(x)]) grid on
subplot(4,2,2) plot(f,abs(X),'r','LineWidth',3) hold on plot(f,real(X),':m','LineWidth',2) plot(f,imag(X),':c','LineWidth',2) hold off title('|X(f)|; Re(X(f)); Im(X(f))') %xlabel('Frequency (Hz.)') ylabel('Magnitude |X(f)|') axis([-10, 10, -max(abs(X)), max(abs(X))]) grid on %legend('|X|','Re|X|','Im(X)','Location','SouthWest','Orientation','horizontal')
subplot(4,2,4), plot(f,angle(X)/pi,'r','LineWidth',2) title('Phase of FFT - \angleX(f)') xlabel('Frequency (Hz.)') ylabel('Phase (\pi radians)') axis([-10, 10, -1 1]) grid on
subplot(2,2,3), plot(tRx,Rx,'b','LineWidth',2); title('Signal Autocorrelation - R_x(\tau)') xlabel('Time lag, \tau (sec.)') ylabel('Amplitude') axis([min(t) max(t) -2*max(Rx) 2*max(Rx)]) grid on
subplot(2,2,4), plot(f,10*log10(Pxx),'r','LineWidth',2) hold on plot(fr,10*log10(Sx),'g--','LineWidth',2) hold off title('Power Spectral Density - S_x(f) in dB') xlabel('Frequency (Hz.)') ylabel('P_x_x (dB/Hz.)') axis([-10, 10, -100, max(max(abs(Sx)),10)]) grid on legend('|X(f)|^2','|fft(Rx(\tau))|','Location','SouthWest')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started