I can' test it, but try this:
m_sym = [fliplr(m), m];
stem(linspace(-808, 808, numel(m_sym)),m_sym)
Question
I'm trying to calculate and plot the result in symetric axis (-x:0:x) However i can only get the result on x-axis from 0:x anyway i'm trying to simulate the LA code autocorrelation and cross correlation for LAS cdma
the code that i'm using :
Ko = 38;
n = 0:10;
for i = 1:length(n)
x(i) = Ko*i+i*(i-1);
end
for n = 11
x11 = x(10)+(Ko+22);
end
for n = 12
x12 = x11+(Ko+24);
end
for n = 13
x13 = x12+(Ko+30);
end
for n = 14
x14 = x13+(Ko+34);
end
for n = 15
x15 = x14+(Ko+38);
end
pulses = [x, x11, x12, x13, x14, x15];
spaces = 0:808;
samplespace = zeros(1,length(spaces));
samplespace(1) = dd(1);
samplespace(39) = dd(39);
samplespace(79) = dd(79);
samplespace(121) = dd(121);
samplespace(165) = dd(165);
samplespace(211) = dd(211);
samplespace(259) = dd(259);
samplespace(309) = dd(309);
samplespace(361) = dd(361);
samplespace(415) = dd(415);
samplespace(471) = dd(471);
samplespace(531) = dd(531);
samplespace(593) = dd(593);
samplespace(661) = dd(661);
samplespace(733) = dd(733);
samplespace(809) = dd(809);
LA_pulse = [samplespace];
otocor=LA_pulse;
N=length(otocor);
y=otocor;
z=otocor;
for i=1:N-1
for i=N-1:-1:1
otocor(i+1)=otocor(i);
end
otocor(1)=0;
z=[z; otocor];
end;
m=[z]*[y'];
m=m/N;
m2=fliplr(m)
stem(m);
how can i plot the results from -808 : 808
and symetric at 0
x-axis ?
as i'm not really sure if i'm doing it right here to calculate autocorrelation for LA code in LAS cdma too
Solution
I can' test it, but try this:
m_sym = [fliplr(m), m];
stem(linspace(-808, 808, numel(m_sym)),m_sym)