view Simulation/runAnalysis_filteredNoise_simulation.m @ 0:ab043bd3b162 tip

First commit
author Alice Clifford <alice.clifford@eecs.qmul.ac.uk>
date Mon, 11 Jun 2012 17:42:13 +0100
parents
children
line wrap: on
line source
%Script to run delay estimation analysis of filtered white noise at various
%bandwidths and with different window shapes


% Developer:  - Alice Clifford (alice.clifford@eecs.qmul.ac.uk)



clear all
close all

addpath ../Functions

Fs=44100;
T=10;


winShapes={
    'blackman',
    'blackmanharris',
    'flattopwin',
    'gausswin',
    'hamming',
    'hann',
    'rectwin',
    };


ds=10; %simulated delay (samples)

input=randn((T*Fs)+ds+1,1);
input=input./max(abs(input)); %white noise input

centreFreq=[0 11025 22050]; %centre frequencies (LP, BP, HP)

bandWidth=logspace(1,5,500); %bandwidths

bandWidth=(bandWidth(bandWidth>50));
bandWidth=bandWidth(bandWidth<22050);
bandWidth=round(bandWidth);


percHits=zeros(length(bandWidth),length(centreFreq));

filterOrder=4;
freqVec=linspace(0,Fs,length(input));

frameSize=2048;
hopSize=frameSize/4;


for w=1:length(winShapes)
    
    for n=1:length(centreFreq)
        
        for m=1:length(bandWidth)
            
            
            [w n m]
            %CREATE FILTERED NOISE VECTOR FROM CENTRE FREQ AND BANDWIDTH
            filtNoise=createFiltNoise(input,centreFreq(n),bandWidth(m),filterOrder,Fs);
            
            %CREATE DELAYED SIGNAL
            x=zeros(length(filtNoise),2);
            
            x(:,1)=filtNoise;
            x(:,2)=filter([zeros(ds,1);1],1,filtNoise);
            
            x=x(ds+1:end,:);
            
            
            delayVec=gccPHATFunc_win(x,frameSize,hopSize,winShapes{w});
            percHitsMat(n,m)=percCorr(delayVec,ds,2);
            
            
        end
        
        
    end
    clear x filtNoise
    
    %save(strcat('Results/noiseExpandBand_',winShapes{w})); %uncomment to
    %save data
    
end

toc