% ATTENTION: it's maybe not possible to construct the dictionary at one time and to use it forever.
% because the memory is so limited compared with the memory needed.
% function: MP algorithm applied to decomposition of bat
% the data to be processed is got by Sao Jun from Zhou Hong xing
% the proposal of this program is just to test
% if this program can run successfully, it should be rewritten in C language to check the speed
% part one: read data (to be processed )
% Here we can input different type of data, to check the program.
%t=0:200-1;
%bat=[0.0029 0.0024 0.002 0.0024 0.0015 0.0015 0.002 0.002 0.0005 0.0015 0.0005 0.0015 0 -0.0015 0.001 0.0015 -0.0049 -0.001 0.0063 -0.0049 -0.0083 0.0127 0.0068 -0.0259 0.0059 0.0386 -0.0405 -0.0269 0.0474 0.0151 -0.063 -0.0093 0.0659 -0.0073 -0.0684 0 0.0728 -0.0146 -0.0752 0.0029 0.0771 -0.0024 -0.085 -0.0063 0.0698 0.0264 -0.0908 -0.0254 0.0605 0.0669 -0.083 -0.0542 0.0347 0.0845 -0.0391 -0.0903 0.0078 0.0737 0.0474 -0.1108 -0.0449 0.0513 0.0903 -0.04 -0.106 0.0049 0.0684 0.0776 -0.0923 -0.0801 0.0366 0.0742 0.0537 -0.1113 -0.0591 0.0508 0.0718 0.0376 -0.1196 -0.0503 0.0527 0.0679 0.0449 -0.1128 -0.0566 0.0508 0.0654 0.0659 -0.1084 -0.0732 0.043 0.064 0.083 -0.0771 -0.104 0.0205 0.0737 0.0762 -0.0068 -0.1357 -0.0234 0.0762 0.0557 0.0771 -0.1216 -0.0918 0.0532 0.0728 0.0723 -0.0156 -0.1436 -0.02 0.0835 0.0498 0.0947 -0.103 -0.1279 0.0405 0.0908 0.0415 0.0732 -0.145 -0.0898 0.0757 0.0786 0.0439 0.0459 -0.1646 -0.0591 0.0903 0.064 0.0415 0.0425 -0.167 -0.0522 0.0869 0.0581 0.0322 0.064 -0.1626 -0.0718 0.0903 0.0679 0.0156 0.0972 -0.1479 -0.1138 0.0786 0.0884 0.0088 0.1069 -0.0942 -0.1675 0.0396 0.1069 0.021 0.0464 0.0327 -0.2012 -0.0376 0.1138 0.063 -0.0083 0.1172 -0.1265 -0.1587 0.0684 0.1138 0.0083 0.0244 0.0742 -0.1958 -0.0674 0.1152 0.084 -0.0205 0.0547 0.0088 -0.2139 -0.0059 0.1362 0.0513 -0.0327 0.0747 -0.0322 -0.208 0.0405 0.145 0.0278 -0.0435 0.0728 -0.0215 -0.2021 0.0444 0.1426 0.022 -0.0557 0.0513 0.04 -0.2031 0.0146 0.1455 0.0317 -0.062 0.0098 0.1226 -0.1719 -0.0596 0.1387];
%bat=[0.0029 0.0024 0.002 0.0024 0.0015 0.0015 0.002 0.002 0.0005 0.0015 0.0005 0.0015 0 -0.0015 0.001 0.0015 -0.0049 -0.001 0.0063 -0.0049 -0.0083 0.0127 0.0068 -0.0259 0.0059 0.0386 -0.0405 -0.0269 0.0474 0.0151 -0.063 -0.0093 0.0659 -0.0073 -0.0684 0 0.0728 -0.0146 -0.0752 0.0029 0.0771 -0.0024 -0.085 -0.0063 0.0698 0.0264 -0.0908 -0.0254 0.0605 0.0669 -0.083 -0.0542 0.0347 0.0845 -0.0391 -0.0903 0.0078 0.0737 0.0474 -0.1108 -0.0449 0.0513 0.0903 -0.04 -0.106 0.0049 0.0684 0.0776 -0.0923 -0.0801 0.0366 0.0742 0.0537 -0.1113 -0.0591 0.0508 0.0718 0.0376 -0.1196 -0.0503 0.0527 0.0679 0.0449 -0.1128 -0.0566 0.0508 0.0654 0.0659 -0.1084 -0.0732 0.043 0.064 0.083 -0.0771 -0.104 0.0205 0.0737 0.0762 -0.0068 -0.1357 -0.0234 0.0762 0.0557 0.0771 -0.1216 -0.0918 0.0532 0.0728 0.0723 -0.0156 -0.1436 -0.02 0.0835 0.0498 0.0947 -0.103 -0.1279 0.0405 0.0908 0.0415 0.0732 -0.145 -0.0898 0.0757 0.0786 0.0439 0.0459 -0.1646 -0.0591 0.0903 0.064 0.0415 0.0425 -0.167 -0.0522 0.0869 0.0581 0.0322 0.064 -0.1626 -0.0718 0.0903 0.0679 0.0156 0.0972 -0.1479 -0.1138 0.0786 0.0884 0.0088 0.1069 -0.0942 -0.1675 0.0396 0.1069 0.021 0.0464 0.0327 -0.2012 -0.0376 0.1138 0.063 -0.0083 0.1172 -0.1265 -0.1587 0.0684 0.1138 0.0083 0.0244 0.0742 -0.1958 -0.0674 0.1152 0.084 -0.0205 0.0547 0.0088 -0.2139 -0.0059 0.1362 0.0513 -0.0327 0.0747 -0.0322 -0.208 0.0405 0.145 0.0278 -0.0435 0.0728 -0.0215 -0.2021 0.0444 0.1426 0.022 -0.0557 0.0513 0.04 -0.2031 0.0146 0.1455 0.0317 -0.062 0.0098 0.1226 -0.1719 -0.0596 0.1387 0.0723 -0.0532 -0.0342 0.1206 -0.0396 -0.1738 0.0718 0.1255 -0.0137 -0.0625 0.02 0.147 -0.1489 -0.084 0.1284 0.0742 -0.0542 -0.0449];
%bat=[0.0029 0.0024 0.002 0.0024 0.0015 0.0015 0.002 0.002 0.0005 0.0015 0.0005 0.0015 0 -0.0015 0.001 0.0015 -0.0049 -0.001 0.0063 -0.0049 -0.0083 0.0127 0.0068 -0.0259 0.0059 0.0386 -0.0405 -0.0269 0.0474 0.0151 -0.063 -0.0093 0.0659 -0.0073 -0.0684 0 0.0728 -0.0146 -0.0752 0.0029 0.0771 -0.0024 -0.085 -0.0063 0.0698 0.0264 -0.0908 -0.0254 0.0605 0.0669 -0.083 -0.0542 0.0347 0.0845 -0.0391 -0.0903 0.0078 0.0737 0.0474 -0.1108 -0.0449 0.0513 0.0903 -0.04 -0.106 0.0049 0.0684 0.0776 -0.0923 -0.0801 0.0366 0.0742 0.0537 -0.1113 -0.0591 0.0508 0.0718 0.0376 -0.1196 -0.0503 0.0527 0.0679 0.0449 -0.1128 -0.0566 0.0508 0.0654 0.0659 -0.1084 -0.0732 0.043 0.064 0.083 -0.0771 -0.104 0.0205 0.0737 0.0762 -0.0068 -0.1357 -0.0234 0.0762 0.0557 0.0771 -0.1216 -0.0918 0.0532 0.0728 0.0723 -0.0156 -0.1436 -0.02 0.0835 0.0498 0.0947 -0.103 -0.1279 0.0405 0.0908 0.0415 0.0732 -0.145 -0.0898 0.0757 0.0786 0.0439 0.0459 -0.1646 -0.0591 0.0903 0.064 0.0415 0.0425 -0.167 -0.0522 0.0869 0.0581 0.0322 0.064 -0.1626 -0.0718 0.0903 0.0679 0.0156 0.0972 -0.1479 -0.1138 0.0786 0.0884 0.0088 0.1069 -0.0942 -0.1675 0.0396 0.1069 0.021 0.0464 0.0327 -0.2012 -0.0376 0.1138 0.063 -0.0083 0.1172 -0.1265 -0.1587 0.0684 0.1138 0.0083 0.0244 0.0742 -0.1958 -0.0674 0.1152 0.084 -0.0205 0.0547 0.0088 -0.2139 -0.0059 0.1362 0.0513 -0.0327 0.0747 -0.0322 -0.208 0.0405 0.145 0.0278 -0.0435 0.0728 -0.0215 -0.2021 0.0444 0.1426 0.022 -0.0557 0.0513 0.04 -0.2031 0.0146 0.1455 0.0317 -0.062 0.0098 0.1226 -0.1719 -0.0596 0.1387 0.0723 -0.0532 -0.0342 0.1206 -0.0396 -0.1738 0.0718 0.1255 -0.0137 -0.0625 0.02 0.147 -0.1489 -0.084 0.1284 0.0742 -0.0542 -0.0449 0.0811 0.0894 -0.1924 -0.0083 0.1348 0.0259 -0.0684 -0.0215 0.105 0.0483 -0.1895 0.0283 0.1279 0.0083 -0.0693 -0.0176 0.1128 0.0566 -0.1865 0.0176 0.126 0.0103 -0.0728 -0.0132 0.0918 0.1035 -0.166 -0.0229 0.1279 0.0278 -0.063 -0.0205 0.0532 0.1431 -0.0923 -0.1108 0.106 0.0684 -0.0449 -0.041 0.0254 0.1025 0.0586 -0.1646 0.0146 0.1128 0.0059 -0.061 -0.0073 0.0454 0.1138 -0.0093 -0.146 0.0703 0.084 -0.0239 -0.0527 0.0122 0.0469 0.0908 -0.0029 -0.123 0.0679 0.0732 -0.0293 -0.0469 0.0181 0.0347 0.0542 0.062 -0.1182 0.0254 0.0811 -0.0068 -0.0444 0.001 0.0347 0.0234 0.0688 -0.0088 -0.0767 0.0703 0.0352 -0.0322 -0.02 0.021 0.0205 0.0088 0.063 0.0186 -0.0596 0.0444 0.0181 -0.0142 -0.0103 0.0083 0.0137 0.0098 0.0303 0.0635 -0.0312 -0.0166 0.0322 0.0024 -0.0083 0 0.0098 0.0137 0.0176 0.0264 0.042 0.0015 -0.0239 0.0142 0.0039 -0.0039 0.001 0.0093 0.0103 0.0166 0.0229 0.0239 0.022 -0.0083 -0.0151 0.0039 0.0059 0.002 0.0039 0.0146 0.0181 0.0156 0.0142 0.0137 0.0088 0.001 -0.0054 -0.0005 0.0029 0.0083 0.0103 0.0132 0.0166 0.0122 0.0078 0.0103 0.0098 0.0049 0.002 0 0.0044 0.0103 0.0107 0.0093 0.0088 0.0083 0.0078 0.0063 0.0049 0.0073 0.002 0.0034 0.0068 0.0073 0.0093 0.0083 0.0083 0.0073 0.0078 0.0063 0.0054 0.0029 0.0024];
t=0:400-1;
bat=(1/sqrt(280))*exp(-pi*((t-200)/280).*((t-200)/280)).*cos(18*((t-200)/280));
%bat=zeros(1,400);
%bat(1,20:40)=1;
%bat(1,200:210)=-1;
%bat(1,250:270)=2;
%bat=[-4 -2 0 -4 -6 -4 -2 -4 -6 -6 -4 -4 -6 -6 -2 6 12 8 0 -16 -38 -60 -84 -90 -66 -32 -4 -2 -4 8 12 12 10 6 6 6 4 0 0 0 0 0 -2 -4 0 0 0 -2 -2 0 0 -2 -2 -2 -2 0];
% check this signal right or not using plot function
% plot(bat);
% size(bat)
% part 2:
% determine the parameters
% the matching pursuit processing iterative number
iterative_number=100;
% the longth of signal and the longth of atoms; N
[a,N]=size(bat);
signal_reconstruct=zeros(1,N);
signal_r=bat;
% scale: the scale is determined by a and j;
% I think that the j shoud include the 0
a_base=2;
j_min=0;
j_max=log2(N);
% the transmission or displacement u should determined as following
u_base=1/2;
p_min=0;
% p_max can be determined by its relationship with j
% the frequency v
v_base=pi;
k_min=0;
% k_max can be determined by its relationship with j;
% the phase w
w_base=pi/6;
i_min=0;
i_max=12;
%parameters=[a_base j_min j_max u_base p_min v_base k_min w_base i_min i_max];
% the following part is not correct because the memory space is very limited compared with the size
% of the dictionary of atoms
%part 2.2 to construct the dictio
评论0