Documentation |
On this page… |
---|
In the System Identification app, time-domain data has an icon with a white background. You can transform time-domain data to frequency-domain or frequency-response data. The frequency values of the resulting frequency vector range from 0 to the Nyquist frequency $${f}_{S}={\scriptscriptstyle \raisebox{1ex}{$\pi $}\!\left/ \!\raisebox{-1ex}{$Ts$}\right.}$$, where T_{s} is the sampling interval.
Transforming from time-domain to frequency-response data is equivalent to estimating a model from the data using the spafdr method.
In the System Identification app, drag the icon of the data you want to transform to the Working Data rectangle.
In the Operations area, select <--Preprocess > Transform data in the drop-down menu to open the Transform Data dialog box.
In the Transform to list, select one of the following:
In the Frequency Spacing list, select the spacing of the frequencies at which the frequency function is estimated:
linear — Uniform spacing of frequency values between the endpoints.
logarithmic — Base-10 logarithmic spacing of frequency values between the endpoints.
In the Number of Frequencies field, enter the number of frequency values.
In the Name of new data field, type the name of the new data set. This name must be unique in the Data Board.
Click Transform to add the new data set to the Data Board in the System Identification app.
Click Close to close the Transform Data dialog box.
In the System Identification app, frequency-domain data has an icon with a green background. You can transform frequency-domain data to time-domain or frequency-response (frequency-function) data.
Transforming from time-domain or frequency-domain data to frequency-response data is equivalent to estimating a nonparametric model of the data using the spafdr method.
In the System Identification app, drag the icon of the data you want to transform to the Working Data rectangle.
Select <--Preprocess > Transform data.
In the Transform to list, select one of the following:
In the Frequency Spacing list, select the spacing of the frequencies at which the frequency function is estimated:
linear — Uniform spacing of frequency values between the endpoints.
logarithmic — Base-10 logarithmic spacing of frequency values between the endpoints.
In the Number of Frequencies field, enter the number of frequency values.
In the Name of new data field, type the name of the new data set. This name must be unique in the Data Board.
Click Transform to add the new data set to the Data Board in the System Identification app.
Click Close to close the Transform Data dialog box.
In the System Identification app, frequency-response data has an icon with a yellow background. You can transform frequency-response data to frequency-domain data (iddata object) or to frequency-response data with a different frequency resolution.
When you select to transform single-input/single-output (SISO) frequency-response data to frequency-domain data, the toolbox creates outputs that equal the frequency responses, and inputs equal to 1. Therefore, the ratio between the Fourier transform of the output and the Fourier transform of the input is equal to the system frequency response.
For the multiple-input case, the toolbox transforms the frequency-response data to frequency-domain data as if each input contributes independently to the entire output of the system and then combines information. For example, if a system has three inputs, u1, u2, and u3 and two frequency samples, the input matrix is set to:
$$\left[\begin{array}{ccc}1& 0& 0\\ 1& 0& 0\\ 0& 1& 0\\ 0& 1& 0\\ 0& 0& 1\\ 0& 0& 1\end{array}\right]$$
In general, for nu inputs and ns samples (the number of frequencies), the input matrix has nu columns and (ns$$\cdot $$ nu) rows.
Note: To create a separate experiment for the response from each input, see Transforming Between Frequency-Domain and Frequency-Response Data. |
When you transform frequency-response data by changing its frequency resolution, you can modify the number of frequency values by changing between linear or logarithmic spacing. You might specify variable frequency spacing to increase the number of data points near the system resonance frequencies, and also make the frequency vector coarser in the region outside the system dynamics. Typically, high-frequency noise dominates away from frequencies where interesting system dynamics occur. The System Identification app lets you specify logarithmic frequency spacing, which results in a variable frequency resolution.
Note: The spafdr command lets you lets you specify any variable frequency resolution. |
In the System Identification app, drag the icon of the data you want to transform to the Working Data rectangle.
Select <--Preprocess > Transform data.
In the Transform to list, select one of the following:
In the Frequency Spacing list, select the spacing of the frequencies at which the frequency function is estimated:
linear — Uniform spacing of frequency values between the endpoints.
logarithmic — Base-10 logarithmic spacing of frequency values between the endpoints.
In the Number of Frequencies field, enter the number of frequency values.
In the Name of new data field, type the name of the new data set. This name must be unique in the Data Board.
Click Transform to add the new data set to the Data Board in the System Identification app.
Click Close to close the Transform Data dialog box.
For a description of time-domain, frequency-domain, and frequency-response data, see Representing Data in MATLAB Workspace.
To learn how to transform data at the command line instead of the app, see Transforming Data Domain at the Command Line.
The following table shows the different ways you can transform data from one data domain to another. If the transformation is supported for a given row and column combination in the table, the method used by the software is listed in the cell at their intersection.
Original Data Format | To Time Domain (iddata object) | To Frequency Domain (iddata object) | To Frequency Function (idfrd object) |
---|---|---|---|
Time Domain (iddata object) | N/A. | Yes, using fft. | Yes, using etfe, spa, or spafdr. |
Frequency Domain (iddata object) | Yes, using ifft. | N/A. | Yes, using etfe, spa, or spafdr. |
Frequency Function (idfrd object) | No. | Yes. Calculation creates frequency-domain iddata object that has the same ratio between output and input as the original idfrd object's response data. | Yes. Calculates a frequency function with different resolution (number and spacing of frequencies) using spafdr. |
The iddata object stores time-domain or frequency-domain data. The following table summarizes the commands for transforming data between time and frequency domains.
Command | Description | Syntax Example |
---|---|---|
fft | Transforms time-domain data to the frequency domain. You can specify N, the number of frequency values. | To transform time-domain iddata object t_data to frequency-domain iddata object f_data with N frequency points, use: f_data = fft(t_data,N) |
ifft | Transforms frequency-domain data to the time domain. Frequencies are linear and equally spaced. | To transform frequency-domainiddata object f_data to time-domain iddata object t_data, use: t_data = ifft(f_data) |
You can transform frequency-response data to frequency-domain data (iddata object). The idfrd object represents complex frequency-response of the system at different frequencies. For a description of this type of data, see Frequency-Response Data Representation.
When you select to transform single-input/single-output (SISO) frequency-response data to frequency-domain data, the toolbox creates outputs that equal the frequency responses, and inputs equal to 1. Therefore, the ratio between the Fourier transform of the output and the Fourier transform of the input is equal to the system frequency response.
For information about changing the frequency resolution of frequency-response data to a new constant or variable (frequency-dependent) resolution, see the spafdr reference page. You might use this feature to increase the number of data points near the system resonance frequencies and make the frequency vector coarser in the region outside the system dynamics. Typically, high-frequency noise dominates away from frequencies where interesting system dynamics occur.
To transform an idfrd object with the name idfrdobj to a frequency-domain iddata object, use the following syntax:
dataf = iddata(idfrdobj)
The resulting frequency-domain iddata object contains values at the same frequencies as the original idfrd object.
For the multiple-input case, the toolbox represents frequency-response data as if each input contributes independently to the entire output of the system and then combines information. For example, if a system has three inputs, u1, u2, and u3 and two frequency samples, the input matrix is set to:
$$\left[\begin{array}{ccc}1& 0& 0\\ 1& 0& 0\\ 0& 1& 0\\ 0& 1& 0\\ 0& 0& 1\\ 0& 0& 1\end{array}\right]$$
In general, for nu inputs and ns samples, the input matrix has nu columns and (ns$$\cdot $$ nu) rows.
If you have ny outputs, the transformation operation produces an output matrix has ny columns and (ns$$\cdot $$ nu) rows using the values in the complex frequency response G(iw) matrix (ny-by-nu-by-ns). In this example, y1 is determined by unfolding G(1,1,:), G(1,2,:), and G(1,3,:) into three column vectors and vertically concatenating these vectors into a single column. Similarly, y2 is determined by unfolding G(2,1,:), G(2,2,:), and G(2,3,:) into three column vectors and vertically concatenating these vectors.
If you are working with multiple inputs, you also have the option of storing the contribution by each input as an independent experiment in a multiexperiment data set. To transform an idfrd object with the name idfrdobj to a multiexperiment data set datf, where each experiment corresponds to each of the inputs in idfrdobj
datf = iddata(idfrdobj,'me')
In this example, the additional argument 'me' specifies that multiple experiments are created.
By default, transformation from frequency-response to frequency-domain data strips away frequencies where the response is inf or NaN. To preserve the entire frequency vector, use datf = iddata(idfrdobj,'inf'). For more information, type help idfrd/iddata.
Transforming from time-domain or frequency-domain data to frequency-response data is equivalent to creating a frequency-response model from the data. For more information, see Identifying Frequency-Response Models.