Help combine the two scripts

1 Ansicht (letzte 30 Tage)
ToasterPanda
ToasterPanda am 18 Mai 2014
Beantwortet: Raghunandan V am 5 Okt. 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 Kommentar
per isakson
per isakson am 18 Mai 2014
Bearbeitet: Image Analyst am 19 Mai 2014
The two scripts looks nearly identical to me. What do you mean by "connect" or "combine" ?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Raghunandan V
Raghunandan V am 5 Okt. 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');

Kategorien

Mehr zu Programming finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by