function [ afg, afG,wafg, afpeak ] = calculate_apparent_freuqency( y, fc, fb ,filtersize) %calculate the apparent frequency of the input signal % y is input signal, fc is center frequency to down conver, fb is frequency % bandwith fso1=exp(-1j*2*pi*fc*(0:size(y,1)-1)'/1e6); fso=repmat(fso1,[1,size(y,2)]); y2=gfilter(y.*fso,1e6,0,fb); y3=G_filter(y.*fso,1e6,0,fb); afg=((real(y2).*[diff(imag(y2));ones([1,size(y,2)])])-(imag(y2).*[diff(real(y2));ones([1,size(y,2)])]))./(2*pi*0.000001*(abs(y2).^2)); afG=((real(y3).*[diff(imag(y3));ones([1,size(y,2)])])-(imag(y3).*[diff(real(y3));ones([1,size(y,2)])]))./(2*pi*0.000001*(abs(y3).^2)); afg(end)=afg(end-1); afG(end)=afG(end-1); % id=abs(y2)