Commit e364ffa1 authored by Riccardo La Placa's avatar Riccardo La Placa
Browse files

Carico prima che esploda durante il test

parent 4068f8f4
Loading
Loading
Loading
Loading
+20 −7
Original line number Diff line number Diff line
@@ -147,11 +147,15 @@ tic
%        x(m,j)=sum(Cmj);
%    end
%end
toc

% Try s* and check \nu_s range
g_jj=((pi*Tseg)^2)/3.*[1; (Tseg^2)/60; (Tseg^3)/1344; (Tseg^4)/172800]; %eq. 22 M2015 + calcoli da eq. 21 M2015
mu_s=0.001; %massimo mismatch sulla griglia coerente da scegliere
s_s=uint8(4);
mu_s=0.5; %massimo mismatch sulla griglia coerente da scegliere
%% Troppo alto mi ma non abbiamo RAM adesso
%% Magari spezzare a blocchi i nibank e poi cercare la minima distanza 
%% in ciascuno?
%s_s=uint8(4);
s_s = 4;
while(1)
    if((nismax(s_s)-nismin(s_s))<delta_ni(mu_s,s_s,g_jj(s_s)))
        s_s=s_s-1;
@@ -179,10 +183,12 @@ end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
nis{s_s+1}=f_gr;
nis{s_s+1}=f_gr.';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
toc

tic
% Resampling the times over nism{m,s} templates
% ---- Andrà fatto per ogni possibile combinazione di nism a un dato m 
% mi sa
@@ -191,12 +197,14 @@ nis{s_s+1}=f_gr;
%%%[kung,fu,fight] = ndgrid(nis{1},nino{2},nino{3});
nibank = combinations(nis{:}).Variables;
Lambda = zeros(length(nibank),M);

toc 
%Fourier transform on original time-series --------------------------------
%per mantenere l'informazione di fase, non faccio il valore assoluto al quadrato della fft

%for each segment (lavoro su tm)
for m=1:M

    tic
 %   [Cm,edges]=(histcounts(x(m,:),round((tm(m,end)-tm(m,1))/dt_psd))); % R - convincitene
 %   edges=edges(end)-edges(1); %mi dà il tempo preciso di tutta la TdF, che sarà leggermente diversa da length(C)*dt per come è definito histcounts 
    Y=fft(x(m,:)).'; 
@@ -209,10 +217,14 @@ for m=1:M
    Y=Y(cond); 
    X=ifft(Y); %inverse-fourier transf.

    toc
    
    %FARE IL RICAMPIONAMENTO!!!!
    % Dev'essere fatto per ciascun template, ergo mettiamo un bel ciclo 
    % sulle possibili combinazioni di ni_s
    for i = 1:length(nibank)
        tic

        % Tento ricampionamento (Eq. 17 MP2015)
        % Per prima cosa, generiamo la nuova coordinata temporale per 
        % questa templ combini 
@@ -250,6 +262,7 @@ for m=1:M
        %Calcolo della detection statistic
        %QUESTA SARA' DA INIZIALIZZARE ALL'ESTERNO tipo Lambda = zeros(length(template),1);
        Lambda(i,m)=sum(abs(Y1).^2)/sum(x(m,:)); %CREDO (oppure prendono la potenza massima?)
        toc
    end

    
@@ -280,7 +293,7 @@ end
%--------------------------------------------------------------------------
%FUNCTIONS
%--------------------------------------------------------------------------
function res = delta_ni(mu_s,s_s,g_jj)
function res = delta_ni(mu_s,s,g)
    %Compute eq. 23 M2015
    res= 2.*sqrt(mu_s./(s_s.*g_jj));
    res= 2.*sqrt(mu_s./(s.*g));
end
 No newline at end of file