% demo0226.m
% True, Good, Bad, and Ugly FFT Plots

clear all;

% Define a time signal
time=[0:1/8000:0.1]; 
x=sin(2*pi*80*time); 

disp('CALCULATING - PLEASE WAIT');

% Find the 'true' FLDTFT
[x_f_true,f_true]=fldtft(x,8000,-800,1,800,0); 

% Find the 'Good' FLDTFT
[x_f_good,f_good]=fldtft(x,8000,-800,80,800,0); 

% Find the 'Bad' FLDTFT
[x_f_bad,f_bad]=fldtft(x,8000,-800,100,800,0); 

% Find the 'ugly' FLDTFT
[x_f_ugly,f_ugly]=fldtft(x,8000,-800,73,800,0); 

while (1==1)
   pick=menu('FLDTFT Spectra',...
      'True FLDTFT Amp. Spectrum',...
      'True and Good',...
      'True and Bad',...
      'True and Ugly',...
      'Quit');
   switch pick
   case 1
      figure(1);clf;
		plot(f_true,20*log10(abs(x_f_true))); hold on; grid on;
		title('True FLDTFT Amplitude spectrum'); 
		xlabel('Frequency (Hz)');ylabel('Amplitude (dB)');
   case 2
      figure(1);clf;
		plot(f_true,20*log10(abs(x_f_true))); hold on; grid on;
		title('True and Good Amplitude spectrum'); 
		xlabel('Frequency (Hz)');ylabel('Amplitude (dB)');
		plot(f_good,20*log10(abs(x_f_good)),'or');
   case 3
      figure(1);clf;
		plot(f_true,20*log10(abs(x_f_true))); hold on; grid on;
		title('True and Bad Amplitude spectrum'); 
		xlabel('Frequency (Hz)');ylabel('Amplitude (dB)');
		plot(f_bad,20*log10(abs(x_f_bad)),'or');
  case 4
      figure(1);clf;
		plot(f_true,20*log10(abs(x_f_true))); hold on; grid on;
		title('True and ugly Amplitude spectrum'); 
		xlabel('Frequency (Hz)');ylabel('Amplitude (dB)');
      plot(f_ugly,20*log10(abs(x_f_ugly)),'or');
   otherwise
      break;
   end;
end;