Скачиваний:
20
Добавлен:
25.12.2019
Размер:
1.29 Кб
Скачать
clc
clear
close all

%% Task №3
weiner1=zeros(700,1);

for i = 1:699
d(1)=0;
d(i+1)=d(i)+normrnd(0,1);
weiner1(i+1,1)=d(i+1);
end
figure();
plot(weiner1);
M=mean(weiner1); %add to report
%% Task №4
for i = 1:699
d1(1)=0;
d1(i+1)=d(i)+normrnd(0,1);
weiner2(i+1,1)=d1(i+1);
end
R=zeros(699,1);
for i = 1:699
R(i,1)=(weiner2(i+1,1)-weiner2(i,1))*(weiner2(i+1,1)-weiner2(i,1));
end
SKO=mean(R); %add to report

clear R d d1
%% Task №5 : autocorrelation coefficient(-1)
acf1 = autocorr(weiner1,'NumLag',1,'NumSTD',1);
acf1 = acf1(2,1);
disp('Task №5.1');
if acf1 >= 0.9
disp('In our example, the relationship between the rows is high and straight');
elseif (acf1 >=0.5) && (acf1 <0.7)
disp('A clear correlation between the rows');
else
disp('Weak or moderate correlation');
end
%% Task №5.1 : autocorrelation coefficient(-2)
acf2 = autocorr(weiner1,'NumLag',2,'NumSTD',1);
acf2 = acf2(3,1);
disp('Task №5.2');
if acf2 >= 0.9
disp('In our example, the relationship between the rows is high and straight');
elseif (acf2 >=0.5) && (acf2 <0.7)
disp('A clear correlation between the rows');
else
disp('Weak or moderate correlation');
end
ACF = table(acf1,acf2);
clear acf1 acf2 i j
%% Task №8
Соседние файлы в папке Лаба 2 (Белый шум и случайные блуждания)