title: Calculating Frequency response from a set of input and a set of output obtained from a test
body: <p>Here is the scenario,</p>
  
  <p>I have a set of input values say 2000, and the corresponding out put values, the sampling rate was 2000 samples/sec, and a sinusoidal wave of 50hz was used, so how do I calculate the frequency response from this varaiables,</p>
  
  <p>what I did in matlab was,</p>
  
  <p>I called all the input values and took the fft of it,</p>
  
  <pre><code>o=data(input),
  n=length(o);fs=2000 %sampliing frequency;
  y=fft(o,n),
  phase=angle(y),
  Pha=180*phase/pi();
  m=length(y);
  f=(0:m-1)*fs/m;
  semilogx(f,Pha), grid on
  </code></pre>
  
  <p>and the response was taken at 90 degree phase angle, is this the right way,</p>
  
  <p>could I create a model from the datas I have and do the frequency response or is there any other way to calculate the response, I am new to matlab and need help</p>