How to get transfer function from a bode plot data?

126 views (last 30 days)
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)

Accepted Answer

Arkadiy Turevskiy
Arkadiy Turevskiy on 22 Nov 2013
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 Comments
Chuqi Chen
Chuqi Chen on 6 Sep 2022
This answer is useful, but I think that 1/Ts should larger than max(w), otherwise it can't work.
Rajiv Singh
Rajiv Singh on 23 Sep 2022
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.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!