Main Content

fitfrd

Fit frequency response data with state-space model

Description

B = fitfrd(A,N) computes a state-space model of order N with a frequency response that approximates the frequency-response model A.

example

B = fitfrd(A,N,RD) forces the relative degree of B to RD. The relative degree of B is the difference between the number of poles and the number of zeros of B.

B = fitfrd(A,N,RD,WT) uses the magnitude of WT to weight the optimization fit criteria A-B. Use WT to give greater weight to matching the responses of B and A at certain frequencies.

Examples

collapse all

Use the fitfrd command to fit D-scale data.

Create D-scale frequency response data from a fifth-order system.

sys = tf([1 2 2],[1 2.5 1.5])*tf(1,[1 0.1]); 
sys = sys*tf([1 3.75 3.5],[1 2.5 13]); 
omeg = logspace(-1,1); 
sysg = frd(sys,omeg); 
bode(sysg,'r-');

MATLAB figure

You can try to fit the frequency response D-scale data sysg with a first-order system, b1. Similarly, you can fit the D-scale data with a third-order system, b3.

b1 = fitfrd(sysg,1); 
b3 = fitfrd(sysg,3);

Compare the original D-scale data sysg with the frequency responses of the first and third-order models calculated by fitfrd.

b1g = frd(b1,omeg); 
b3g = frd(b3,omeg); 
bode(sysg,'r-',b1g,'k:',b3g,'b-.')
legend('5th order system','1st order fit','3rd order fit','Location','Southwest')

MATLAB figure

ans = 
  Legend (5th order system, 1st order fit, 3rd order fit) with properties:

         String: {'5th order system'  '1st order fit'  '3rd order fit'}
       Location: 'southwest'
    Orientation: 'vertical'
       FontSize: 8.1000
       Position: [0.1504 0.5945 0.2827 0.1278]
          Units: 'normalized'

  Use GET to show all properties

Input Arguments

collapse all

Frequency response data, specified as an frd model. A must be SISO, have a single input with multiple outputs, or have multiple outputs with a single input.

Order of output model B, specified as a nonnegative integer. Numerical conditioning problems arise if the specified N is higher than required by the dynamics of A.

Relative degree, specified as a nonnegative integer or vector. The default value for RD is 0. If A has M inputs, then RD can be a vector of the same size, specifying the relative degree of each channel of B. If RD is a scalar, then it specifies the relative degree for all entries of B. You can specify the default value for RD by setting RD to an empty matrix.

Weight, specified as an array, ss model, orfrd model. If WT is a scalar, then it is used to weight all entries of the error criteria (A-B). If WT is a vector, it must be the same size as A, and each individual entry of WT acts as a weighting function on the corresponding entry of (A-B).

Output Arguments

collapse all

Fit for the input frequency-response data, returned as a state-space (ss) model. B has order N and the same dimensions as A.

Version History

Introduced before R2006a

See Also