%_______________________________________________________________________  
% PLOTLOG.M          Matlab script to plot ADSP-21020 FFT results
%
% 21-MAR-91, Steven Cox, Analog Devices DSP Div. 
%_______________________________________________________________________
load inreal.mat;
load inimag.mat;
j=sqrt(-1);
incplx=inreal+(inimag*j);
load rdata.mat;
load idata.mat;
y=(1:input('Enter length of FFT > '));

mlb=20*log10(abs(fft(incplx)));
chip=20*log10(sqrt((rdata.*rdata)+(idata.*idata)));
plot(y,mlb,'r',y,chip,'g')
grid
title('Log Magnitude Comparison, 21k in green')
pause

plot(y,abs(fft(incplx)),'r',y,(sqrt((rdata.*rdata)+(idata.*idata))),'g')
grid
title('Magnitude Comparison, 21k in green')
pause

plot(y,abs(fft(incplx))-(sqrt((rdata.*rdata)+(idata.*idata))))
grid
title('Error in Magnitude')
pause

plot(y,real(fft(incplx)),'r',y,rdata,'g')
grid
title('Real Part Comparison, 21k in green')
pause
plot(y,real(fft(incplx))-rdata)
grid
title('Error in Real')
pause

plot(y,imag(fft(incplx)),'r',y,idata,'g')
grid
title('Imaginary Part Comparison, 21k in green')
pause
plot(y,imag(fft(incplx))-idata)
grid
title('Error in Imaginary')
pause
