title: Phase spectrum of sine wave with Matlab
body: <p>I'm trying to plot a phase spectrum of sine wave with Matlab. Below I attach code, I can't attach diagrams due to the lack of reputations. As magnitude spectrum seems to be good, the phase spectrum seems to be uncorrect, it's like a noise. Do you have any idea why?</p>
  
  <pre><code>clear all;
  
  fs=8000;
  l=1000;
  t=1/fs*(1:l);
  
  x1=sin(2*pi()*1000*t);
  spec_x1=fft(x1,1000);
  magnitude=2*abs(spec_x1)/l;
  phase=angle(spec_x1)*180/pi;
  
  figure
  plot(fs/2*linspace(0,1,500),magnitude(1:500));
  title('Magnitude spectrum');
  xlabel('F[Hz]');
  ylabel('Magnitude');
  
  figure
  plot(fs/2*linspace(0,1,500),phase(1:500));
  title('Phase spectrum');
  xlabel('F[Hz]');
  ylabel('Phase [degrees]');
  </code></pre>