Help combine the two scripts

1 visualización (últimos 30 días)
ToasterPanda
ToasterPanda el 18 de Mayo de 2014
Respondida: Raghunandan V el 5 de Oct. de 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 comentario
per isakson
per isakson el 18 de Mayo de 2014
Editada: Image Analyst el 19 de Mayo de 2014
The two scripts looks nearly identical to me. What do you mean by "connect" or "combine" ?

Iniciar sesión para comentar.

Respuestas (1)

Raghunandan V
Raghunandan V el 5 de Oct. de 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');

Categorías

Más información sobre Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by