I have loaded a logarithmic swept sine (with some short fade in/fade out) into Matlab and run it through the fft function and plot it using semilog.
The input signal amplitude is almost constant in 10 ... 20000 Hz range. So to represent more accurately what is going on, I would like to see the graph as almost horizontal line.
What formula should I apply to make the AFR graph horizontal?
The Matlab script I used to plot the graph:
fid = fopen('sweepfaded.raw','rb');   %open file
data = fread(fid, inf, 'float32');  %read in the data
fclose(fid);   %close file
n = size(data,1);
n = 2^nextpow2(n); % Next power of 2 from length of audio - 2-powers are faster to calculate
p = fft(data, n); % take the fourier transform 
nUniquePts = ceil((n+1)/2); 
p = p(1:nUniquePts); % select just the first half since the second half 
                       % is a mirror image of the first
p = abs(p); % take the absolute value, or the magnitude 
p = p/n; % scale by the number of points so that
           % the magnitude does not depend on the length 
           % of the signal or on its sampling frequency  
p = p.^2;  % square it to get the power 
sampFreq = 44100;
freqArray = (0:nUniquePts-1) * (sampFreq / n); % create the frequency array 
semilogx(freqArray, 10*log10(p)) 
xlabel('Frequency (Hz)') 
ylabel('Power (dB)') 
The resulting plot which I would like to be horizontal (like applying some rotation to it so the range 100...10000 Hz becomes a horizontal line):

P.S. I am not good at audio signal processing, I am just a generic programmer, so do not waste your time trying to explain what is going on (although I guess, someday I'll have to read a good DSP book anyway). Just a correct formula to insert into my Matlab script will be good enough.