clear all
clc
load accn.mat
fs=1000;
nfft=20000;
noverlap=1024;
x1=accn(:,3);
for i=1:21
y1(:,i)=accn(:,i);
[R_1(:,i),t] = corrf(x1,y1(:,i),fs,nfft,hanning(nfft),noverlap);
end
save R_1.mat R_1
%%%%%%%%%%%%%%%%%%
for i=8:16
y2(:,i-7)=accn(:,i);
[R_2(:,i-7),t] = corrf(x1,y2(:,i-7),fs,nfft,hanning(nfft),noverlap);
end
save R_2.mat R_2
%%%%%%%%%%%%%%%%%%
x2=accn(:,16);
for i=16:21
y3(:,i-15)=accn(:,i);
[R_3(:,i-15),t] = corrf(x2,y3(:,i-15),fs,nfft,hanning(nfft),noverlap);
end
save R_3.mat R_3
%%%%%%%%%%% ERA
load R_1.mat;
system_order = 16; % order of the system
RefIndex = 1; % index for reference signal
ncols =1200; % number of columns in the Hankel matrix
nrows =4800; % number of rows in the Hankel matrix
[fd_1,zeta_1,shapes_1,lambda_1,partfac_1,EMAC_1,sv_1,Aout_1,Bout_1,Cout_1] = ... % run ERA
era(R_1,fs,ncols,nrows,length(RefIndex),system_order);
save shapes_1.mat shapes_1
%%%%%%%%%%%%%%%%%
load R_2.mat;
system_order = 18; % order of the system
[fd_2,zeta_2,shapes_2,lambda_2,partfac_2,EMAC_2,sv_2,Aout_2,Bout_2,Cout_2] = ... % run ERA
era(R_2,fs,ncols,nrows,length(RefIndex),system_order);
% save shapes_2.mat shapes_2
%%%%%%%%%%%%%%%%%
load R_3.mat;
ncols =1000;
nrows =3600;
system_order = 12;
% number of columns in the Hankel matrix
% order of the system
% shapes_1(:,2)=[];
% shapes_2(:,1)=[];
% ncols=500;
% nrows=4000;
[fd_3,zeta_3,shapes_3,lambda_3,partfac_3,EMAC_3,sv_3,Aout_3,Bout_3,Cout_3] = ... % run ERA
era(R_3,fs,ncols,nrows,length(RefIndex),system_order);
% save shapes_3.mat shapes_3
%%%%%%%%%%%%%%%%װ
% load shapes_1.mat;
% load shapes_2.mat;
% load shapes_3.mat;
%
shapesnew=zeros(25,3);
% shapes_new2=zeros(4,3);
% shapes_new3=zeros(5,3);
vv=[1 2 3];ww=[1 2 3];
for j=1:3
i=vv(j);
k=ww(j);
a=shapes_3(1,j);b=shapes_2(9,k);c=shapes_2(1,k);d=shapes_1(8,i);
shapes1(:,j)=[shapes_1(:,i);(d/c)*shapes_2(:,k) ;(b/a)*(d/c)*shapes_3(:,j) ];
end
shapes1(8,:)=[];shapes1(16,:)=[];
aaa=[2 3 4 5 6 7 8 10 11 12 13 14 15 16 17 18 20 21 22 23 24];
for i=1:21
shapesnew(aaa(i),:)=shapes1(i,:);
end
save shapesnew.mat shapesnew
% for i=1:3
% figure
% plot(shapesnew(:,i))
% grid on
%
% end
clear all
load modelnew.mat
load shapesnew.mat
shapes1=shapesnew(:,1)/-shapesnew(14,1);
shapes2=shapesnew(:,2)/-shapesnew(4,2);
shapes3=shapesnew(:,3)/shapesnew(22,3);
shapes=[shapes1,shapes2,shapes3];
a=[20,21,19];
for i=1:3
figure
plot (modelnew(:,a(i)),'-*')
hold on
plot (shapes(:,i),'--')
hold off
grid on
end