Logaritmic amplitude squarewave This morning i was experimenting with GNU Octave.
I created several signals(Sine, Saw tooth, square wave and noise). After this i used the periodogram. in the periodogram the square wave weren't showed.
I tried a test file from where the square wave is broken.



A = 1;
f = 2;
T = 2;
fs = 512;

if isOctave = exist('OCTAVE_VERSION', 'builtin') ~= 0;
    pkg load signal
    clear isOctave;
end

t = 0:1/fs:T-1/fs ;
sine = A * sin(2*pi*f*t);
sq =  A * square(2*pi*f*t);
F = 0:(fs/(T*fs)):fs/2;
SINE = fft(sine);SINE = abs(SINE(1,1:(T*fs)/2+1));
SQ = fft(sq); SQ = abs(SQ(1,1:(T*fs)/2+1));


figure;
subplot(2,1,1); plot(t,sine, t,sq); 
legend('Sine', 'Square','Location','northoutside','Orientation','horizontal')
subplot(2,1,2); plot( F, 20*log10(1/(length(SINE))*SINE), F,20*log10(1/(length(SQ))* SQ));

figure
periodogram(sine,[],length(sine),fs,'power'); hold all
periodogram(sq,[],length(sq),fs,'power')
legend('sine','square')


What i found out is that till the fft everything works as suspected.
But when i take the log of the square wave. the result disappears.  

My question is why does this happening?    


what cause this problem. 
Happens this also in Matlab or python. 
What solution fix this problem?
The library function log of zero results in a NaN (not a real number, -inf).  So the log of a square with a base of zero can't be plotted.