How to get transfer function from a bode plot data?

I have a set of bode plot data with Gain in decibel and Frequency in Hz and after I import the data into MATLAB, I am confused on using which function to create d objects..( iddata or idfrd) where I gona used tfest function to estimate d transfer function..And could tfest gives the transfer function where the data is in decibel..TF= output/input , but TF= output(dB)-input(dB)

 采纳的回答

This example shows how to do what you want.
You will need to create idfrd or frd objct to use with tfest. In addition to gain, you also need phase data to create a complex number at each frequency to represent your system response.
To construct frd or idfrd object, you need the gain of the system, not in db. To convert from db:
gain=10^(gaindb/20);
Create idfrd object:
response = gain.*exp(1i*phase*pi/180);
Ts = 0.1; % your sampling time
w=whz*2*pi; %convert Hz to rad/sec
gfr = idfrd(response,w,Ts);
Estimate 2nd ordertransfer function
sys=tfest(gfr,2);
Compute the gain in db:
[mag,ph]=bode(sys,w);
magdb=20*log10(mag);

4 个评论

So,response consists of a imported data with first column gain data 2nd column phase data in degree and third column frequency in rad/s ? Btw, the 2 in tfest function doesnt means the estimated poles number?
Or the response is just a complex number of gain and phase? and w is the frequency in rad/sec? Can we put zero as a sampling time? as the frequency doesnt follow a fix sequence of increament..
This answer is useful, but I think that 1/Ts should larger than max(w), otherwise it can't work.
Note that:
  1. The workflow described in the solution applies to the continuous-time data also (Ts=0)
  2. For discrete-time data (gfr.Ts>0), w is allowed to contain values greater than the Nyquist frequency ( that is, w > 0.5/Ts hertz). In this case, there are two possible scenarios:
  • If the respose data corresponds to a real system (this also assumes that w is uniformly spaced), then any values above the Nyquist are simply ignored. Correct answer is still produced.
  • If the w values are not uniformly spaced and/or the response values do not respect the shape of the response for real systems, then no frequencies are ignored and a complex-valued model is fit to the data.
Recall that for real discrete-time systems, response in the frequency range 0.5/Ts - 1/Ts is a mirror image of the response in the range 0 - 0.5/Ts, and the response replicates for each integer multiple of 1/Ts.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by