-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFnS3.m
43 lines (38 loc) · 1.95 KB
/
FnS3.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
% [1] E. Eqlimi and B. Makkiabadi, “Multiple sparse component analysis
% based on subspace selective search algorithm,” in 2015 23rd Iranian
% Conference on Electrical Engineering. IEEE, 2015, pp. 550–554
%
% [2] E. Eqlimi and B. Makkiabadi, “An efficient K-SCA based unerdetermined
% channel identification algorithm for online applications,” in 2015
% 23rd European Signal Processing Conference (EUSIPCO). IEEE, 2015,
% pp. 2661–2665.
%Please cite the above papers in case of any usage or benchmarking.
%
% (C) Ehsan Eqlimi, Jan 2015, @Biomedical Engineering Group, Tehran
% Universty of Medical Scineces (TUMS), Tehran, Iran
% https://github.com/EhsanEqlimi/Sparse-UBI-S3
% Ehsun.Eghlimi@gmail.com, Eghlimi@razi.tumss.ac.ir
%%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
% OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
% AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER
% OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
% DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
% DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
% IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
% OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
function [Subspaces,CountinEachWhile,NewSubspace]=FnS3(X,Th1,Level,Subspaces,CountinEachWhile)
NewSubspace=[];
m=size(X,1);
P=m-Level;
idx=randperm(size(X,2));
p=idx(1:P);
XX = X(:,p);
[V,D] = eig((XX*XX'));
if abs(D(1+1*Level,1+1*Level))/abs(D(end,end))<Th1 %&& D(2,2)/D(end,end)<th1%&& D(1,1)/D(2,2)<1e-3
W1=V(:,1);
Subspaces=[Subspaces W1];
% size(AllVecs,2)
CountinEachWhile=CountinEachWhile+1;
NewSubspace=W1;
end