# RLLspectrum - Author Andrew Harms Date Copyright(c 2013 by...

• Test Prep
• 1

This preview shows page 1 out of 1 page.

% Author: Andrew Harms % Date: 03/31/2013 % Copyright (c) 2013 by Andrew Harms. This work is made available under % the terms of the Creative Commons Attribution-ShareAlike 3.0 license function [R TV F] = RLLspectrum(d,k,p,maxM) % Calulate the autocorrelation (R), total variation (TV), and spectrum (F) % of the (d,k) rll sequence with transition probability 'p'. MaxM tells % how much resolution is desired in the spectrum. extraM = max(0,maxM-63); m = 1:min(63,maxM); R = zeros(1,length(m)); TV = zeros(1,length(m)); % p = [0 0.5 0.5 0.5 0.5 0.5 1]; % [P pie] = create_P(p); [P pie] = rll_create_P(d,k,p); [a,b] = rll_ab_vecs(d,k,pie); a1 = [ones(1,length(a)/2) zeros(1,length(a)/2)]; a2 = [zeros(1,length(a)/2) ones(1,length(a)/2)]; b1 = a1/21; % Calculate the correlation R_x(m) = aP^(m)b' for i=m R(i) = a*P^(i)*b'; % autocorrelation TV(i) = abs(a1*P^(i)*b1' - a2*P^(i)*b1');

#### You've reached the end of your free preview.

Want to read the whole page?

Unformatted text preview: % total variation end % Spectrum of the rll waveform F = fft([1 R zeros(1,extraM) R(end:-1:1)])/(d+1); % Plot spectrum if desired plot_figures = 0; if plot_figures f = (0:(length(F)-1))/length(F)-0.5; figure; plot(f,abs(abs((fftshift(F)))-1)); axis([f(1) f(end) 0 2]); figure; plot(f,((abs(fftshift(F)))), 'Linewidth', 4); grid on; % title('Spectrum of RLL sequence'); xlabel('Frequency Index: \omega / W', 'Fontsize', 24); ylabel('Amplitude', 'Fontsize', 24); axis([f(1) f(end) 0 2]); Frcs = 1/2 + cos(2*pi*f+pi)/2; figure; plot(f,((abs(fftshift(Frcs)))), 'Linewidth', 4); grid on; % title('Spectrum of RLL sequence'); xlabel('Frequency Index: \omega / W', 'Fontsize', 24); ylabel('Amplitude', 'Fontsize', 24); axis([f(1) f(end) 0 2]); end % if plot_figures end % function...
View Full Document

• Fall '15

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern