% test 60 Hz canceller clear all Fs = 44100; dt = 1/Fs; t = 0:dt:.5; %reference noise ref = sin(2*pi*60*t) ;%+0.3*sin(2*pi*180*t); %define APs AP1amp = 1; AP1dur1 = .001; AP1dur2 = .002; AP1prob = .001; AP2amp = AP1amp*.5; %make single AP %by concantenating two 1/2 sin cycles oneT = 0:dt:(AP1dur1+AP1dur2); oneAP = AP1amp*sin(2*pi/(2*AP1dur1)*oneT).*(oneT<=AP1dur1) + ... AP1amp*0.5*sin(2*pi/(2*AP1dur2)*(oneT+AP1dur1)).*(oneT>AP1dur1) ; %make a bunch of APs locationAP1 = rand(size(t))