How can I get a time response from FRD model

18 views (last 30 days)
I have a model in FRD mode, I want to a) get a time response of this model, b) implement it in Simulink (both seems to be unavailable in Matlab)

Accepted Answer

Sam Chak
Sam Chak on 8 Dec 2023
There isn't a direct function called 'frd2ss()' for the conversion you're looking for. However, you can estimate a state-space model from available frequency response data (FRD) using the 'ssest()' function. This function will provide you with the estimated state-space model, which you can then use in Simulink for simulation. This will allow you to obtain the time response of the equivalent FRD model.
%% Dummy state-space for FRD generation
ssA = [0 1; -1 -2];
ssB = [0; 1];
ssC = [1 0];
ssD = 0*ssC*ssB;
ss_Sys = ss(ssA, ssB, ssC, ssD);
%% Obtain Frequency-Response Data model
w = logspace(-2, 2, 50);
frdSys = frd(ss_Sys, w)
frdSys = Frequency(rad/s) Response ---------------- -------- 0.0100 9.997e-01 - 2.000e-02i 0.0121 9.996e-01 - 2.413e-02i 0.0146 9.994e-01 - 2.911e-02i 0.0176 9.991e-01 - 3.513e-02i 0.0212 9.987e-01 - 4.238e-02i 0.0256 9.980e-01 - 5.112e-02i 0.0309 9.971e-01 - 6.166e-02i 0.0373 9.958e-01 - 7.435e-02i 0.0450 9.939e-01 - 8.961e-02i 0.0543 9.912e-01 - 1.079e-01i 0.0655 9.872e-01 - 1.299e-01i 0.0791 9.814e-01 - 1.562e-01i 0.0954 9.731e-01 - 1.874e-01i 0.1151 9.611e-01 - 2.243e-01i 0.1389 9.439e-01 - 2.675e-01i 0.1677 9.194e-01 - 3.173e-01i 0.2024 8.851e-01 - 3.735e-01i 0.2442 8.375e-01 - 4.350e-01i 0.2947 7.730e-01 - 4.990e-01i 0.3556 6.884e-01 - 5.605e-01i 0.4292 5.817e-01 - 6.121e-01i 0.5179 4.549e-01 - 6.440e-01i 0.6251 3.150e-01 - 6.464e-01i 0.7543 1.751e-01 - 6.128e-01i 0.9103 5.124e-02 - 5.444e-01i 1.0985 -4.246e-02 - 4.512e-01i 1.3257 -9.962e-02 - 3.487e-01i 1.5999 -1.231e-01 - 2.525e-01i 1.9307 -1.220e-01 - 1.728e-01i 2.3300 -1.072e-01 - 1.128e-01i 2.8118 -8.707e-02 - 7.090e-02i 3.3932 -6.714e-02 - 4.334e-02i 4.0949 -4.995e-02 - 2.594e-02i 4.9417 -3.624e-02 - 1.529e-02i 5.9636 -2.585e-02 - 8.921e-03i 7.1969 -1.822e-02 - 5.164e-03i 8.6851 -1.274e-02 - 2.973e-03i 10.4811 -8.858e-03 - 1.706e-03i 12.6486 -6.135e-03 - 9.761e-04i 15.2642 -4.237e-03 - 5.576e-04i 18.4207 -2.921e-03 - 3.181e-04i 22.2300 -2.011e-03 - 1.813e-04i 26.8270 -1.384e-03 - 1.033e-04i 32.3746 -9.514e-04 - 5.883e-05i 39.0694 -6.538e-04 - 3.349e-05i 47.1487 -4.492e-04 - 1.906e-05i 56.8987 -3.086e-04 - 1.085e-05i 68.6649 -2.120e-04 - 6.175e-06i 82.8643 -1.456e-04 - 3.514e-06i 100.0000 -9.997e-05 - 2.000e-06i Continuous-time frequency response.
bode(ss_Sys,'b', frdSys,'r--'), grid on
%% Convert Frequency-Response Data model to Linear Time-Invariant System
ltiSys = ssest(frdSys)
ltiSys = Continuous-time identified state-space model: dx/dt = A x(t) + B u(t) + K e(t) y(t) = C x(t) + D u(t) + e(t) A = x1 x2 x1 -1 1 x2 -2.302e-14 -1 B = u1 x1 0 x2 1 C = x1 x2 y1 1 0 D = u1 y1 0 K = y1 x1 0 x2 0 Parameterization: FREE form (all coefficients in A, B, C free). Feedthrough: none Disturbance component: none Number of free coefficients: 8 Use "idssdata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using SSEST on frequency response data "frdSys". Fit to estimation data: 100% FPE: 9.314e-30, MSE: 7.935e-30
%% Extract matrices and store in Workspace for State-space block in Simulink
A = ltiSys.A; % state matrix
B = ltiSys.B; % input matrix
C = ltiSys.C; % output matrix
D = ltiSys.D; % direct matrix
%% Time response of the equivalent FRD model
step(ltiSys), grid on

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!