function [unew,vnew,tnew]=tidesam3(ucoef,vcoef,which);
%function [unew,vnew,tnew]=tidesam3(ucoef,vcoef,which);
%          Which is 2,4 or 6, to determine which coefficients
%         to make timeseries of only one constituent
%		resampled timeseries using time array tnew;
tnew=6:12.42/12:18.42;
fac0=input('type 1 to include mean, 0 to leave out ');
[imax,jmax]=size(ucoef);
unew=[];
vnew=[];
period=[12.42 6.21 4.14];
freq=2*pi*ones(period)./period;
i=1:imax;
im=sqrt(-1);
%...........................................   put in mean
unew(i,:)=ucoef(i,1)*ones(tnew)*fac0;
vnew(i,:)=vcoef(i,1)*ones(tnew)*fac0;
%............................................  put in tide freqs
for j=which/2
     unew(i,:)=unew(i,:)+real((ucoef(i,j*2)+im*ucoef(i,j*2+1))*..
                                           exp(-im*freq(j)*tnew));
     vnew(i,:)=vnew(i,:)+real((vcoef(i,j*2)+im*vcoef(i,j*2+1))*..
                                           exp(-im*freq(j)*tnew));
end
