I don't see anything that's version-dependent here. I just see a bunch of problems likely caused by copying and pasting code from a website somewhere.
- MATLAB does not support curly quotes. Use a regular straight single quote mark.
- Variable and function names cannot have spaces.
- AFAIK, there is no MATLAB function called replicate(). Maybe that's supposed to be remat(), or maybe something else.
The first two problems (pretty quotes and stripping underscores) end up happening when code is blindly subjected to automated formatting.
pntaps = [0 0 1 0 0 0 0 0 0 1];
pninitial = [0 0 0 0 0 0 0 0 0 1];
pndata = zeros(1,1023);
samp_per_sym = 1;
pnregister = pninitial;
n = 0;
kk = 0;
while kk == 0
n = n+1;
pndata(1,n) = pnregister(1,1);
feedback = rem((pnregister*pntaps'),2);
pnregister = [feedback,pnregister(1,1:9)];
if pnregister == pninitial; kk = 1; end
end
text = ['The period is ',num2str(n,15),'.'];
disp(text)
pndata=repmat(pndata,samp_per_sym);
kn = n*samp_per_sym;
pndata = 2*pndata - 1;
a = fft(pndata);
b = a.*conj(a);
Rm = real(ifft(b))/kn;
x1 = (0:length(Rm)-1)/samp_per_sym;
x2 = 0:100;
subplot(3,1,1)
plot(x1,Rm,'.k'); ylabel('R[m]')
subplot(3,1,2)
stem(x2,Rm(1:101),'.k'); ylabel('Partial R[m]')
subplot(3,1,3)
stem(x2,pndata(1:101),'.k'); ylabel('First 100 outputs')
axis([0 100 -1.5 1.5]);
