function [Bout,x,y]=zmodfb(y,Fs,NFFT,TD)
%[B,x,y]=zmodfb(y,Fs,NFFT)
%
% compute the forward/backward Campbell/specgtrogram
%
% INPUT:
% y (n x 2) each column is measured from a different sensor
% ///////
% __
% |s1| y(:,1)
% |__|
% __
% / \ ________|/
% | | | s2 |/ y(:,2)
% \____/ --------|/
%
% Fs Sampling frequnecy
%
% OUTPUT:
% B spectrogram/Campbel diagram
% x x-axis coordinate vector (time or Speed)
% y y-axis coordinate vector (frequency [Hz])
%
% use:
% imagesc(x,y,20*log(abs(B))), colormap(jet)
% to obtain a plot
%
% by: I. Bucher
% Date 6-Sep-95
if nargin<2, Fs=1000; end
if nargin<3, NFFT=[]; end % i.e. automatic selection of NFFT
[B1,F,x]=specgram(y(:,1),NFFT,Fs);
[B2 ]=specgram(y(:,2),NFFT);
[n m]=size(B1);
B=[flipud(B1-i*B2) ; B1(2:n,:)+i*B2(2:n,:)];
ny=2*n-1; y=([0:ny-1]/(ny-1) - 0.5)*(Fs);
if nargout<1,
if nargin>3
surf(x,(y(:)),(abs(((B)))))
shading interp
figure(gcf)
else
newplot;
imagesc(x,(y(:)),20*log10(abs(((B)))))
colormap(jet)
figure(gcf)
end
else,
Bout=B;
end