Help combine the two scripts

1 view (last 30 days)
ToasterPanda
ToasterPanda on 18 May 2014
Answered: Raghunandan V on 5 Oct 2018
Maybe someone can help connect these two scripts:
clear all;
x=[2 2 2 2 2 2 2 2 2 2]
autocorr(x);
N=length(x);
y=x;
z=x;
for i=1:N-1
for i=N-1:-1:1
x(i+1)=x(i);
end
x(1)=0;
z=[z; x];
end;
m=[z]*[y'];
m=m/N
stem(m);
title('auto-correlation');
xlabel('time index');
ylabel('amplitude');
and
clear all;
x=[2 2 2 2 2 2 2 2 2 2]
autocorr(x);
N=length(x);
y=x;
z=x;
for i=1:N-1
for i=N-1:-1:1
x(i+1)=x(i);
end
x(1)=0;
z=[z; x];
end;
m=[z]*[y'];
g=m/N
stem(g, g');
title('auto-correlation');
xlabel('time index');
  1 Comment
per isakson
per isakson on 18 May 2014
Edited: Image Analyst on 19 May 2014
The two scripts looks nearly identical to me. What do you mean by "connect" or "combine" ?

Sign in to comment.

Answers (1)

Raghunandan V
Raghunandan V on 5 Oct 2018
% clear all;
x=[2 2 2 2 2 2 2 2 2 2]
autocorr(x);
N=length(x);
y=x;
z=x;
for i=1:N-1
for i=N-1:-1:1
x(i+1)=x(i);
end
x(1)=0;
z=[z; x];
end;
m=[z]*[y'];
g=m/N
stem(g, g');
title('auto-correlation');
xlabel('time index');
m=m/N
stem(m);
title('auto-correlation');
xlabel('time index');
ylabel('amplitude');

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!