Calculating Frequency response from a set of input and a set of output obtained from a test
Here is the scenario,
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 开发者_StackOverflowof 50hz was used, so how do I calculate the frequency response from this varaiables,
what I did in matlab was,
I called all the input values and took the fft of it,
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
and the response was taken at 90 degree phase angle, is this the right way,
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
If your input was just a single sinusoid at 50 Hz then you can not measure the frequency response - all you can measure is the gain and phase shift at that one specific frequency. Taking FFTs etc will not tell you anything more about the frequency response, although it can be used to measure the noise and the effect of any non-linearities in your system.
If you want to measure frequency response then your input signal needs to be broad band and cover the frequency range of interest, e.g. noise, an impulse, or a swept sinusoid.
精彩评论