bleeck@4: function sig=reduce_tilt(sig,options) bleeck@4: bleeck@4: bleeck@4: plot_switch=1; bleeck@4: bleeck@4: lowpassfactor=100; % relationship between Samplefrequency and lowpassfrequency bleeck@4: bleeck@4: % shift all values that are zero at the beginning to the first bleeck@4: % positive value. This makes the lowpass continuous for high bleeck@4: % frequencies bleeck@4: sr=getsr(sig); bleeck@4: stip=getvalues(sig); bleeck@4: bleeck@4: indx=find(stip>0); bleeck@4: if ~isempty(indx) bleeck@4: first_non_zero=stip(indx(1)); bleeck@4: stip(1:indx(1))=first_non_zero; bleeck@4: stip=[ones(200,1)*first_non_zero;stip]; bleeck@4: end bleeck@4: s=signal(stip,sr); bleeck@4: s=reverse(s); bleeck@4: s2=lowpass(s,sr/lowpassfactor); bleeck@4: diff=s-s2; bleeck@4: bleeck@4: % s2=getpart(s2,0,getlength(sig)); bleeck@4: bleeck@4: bleeck@4: if plot_switch bleeck@4: figure(4) bleeck@4: clf bleeck@4: plot(s); bleeck@4: hold on bleeck@4: plot(s2,'r'); bleeck@4: plot(diff,'g') bleeck@4: axis([0 getnrpoints(sig) min(diff)-10 max(sig)+10]); bleeck@4: end bleeck@4: bleeck@4: diff=getpart(diff,0,getlength(sig)); bleeck@4: diff=reverse(diff); bleeck@4: bleeck@4: bleeck@4: % return value bleeck@4: sig=diff;