function[y,fs,fb,fc]=ask(x,kbase,fs,fb,fc);
%
% Usage:[y,fs,fb,fc]=ask(x,fs,fb,fc); BBI 2000
if nargin if nargin if nargin if nargin if nargin T=length(x)/fb; m=fs/fb;
dt=1/fs; t=0: dt: T-dt;
xx=pulse (x, m, 2);
if Kbase==2; xx=bshape(xx); end;
y=(xx>=0).*sin(2*pi*fc*t); %ASk or OOK
%--------------------------------------------------------------------------
if nargout subplot(211); plot(t,y,t,xx*.5,[0 T],[0 0],'b:');
title('signal');
n=length(y); yy=fft(y)/n; y=abs(y(1:fix(n/2)))*2;
I=find(y f1=m/n; f=0:f1:(length(y)-1)*f1;
subplot(212); plot(f,y,'r');grid on ;
title('Spectrum'); xlabel('f/fb'); zoom xon;
set(gcf, 'num','off','name',...
['ASK(OOK),' blanks(10) ' BBI 2000']);
end;