How to extract idpoly property to workspace

5 views (last 30 days)
Hi, how can I extract and put in my workspace variable A and NoiseVariance from idpoly to do further processing?

Accepted Answer

Star Strider
Star Strider on 31 Dec 2022
There are several properties that can be retrieved from the System Identification Toolbox ‘data’ objects. See the documentation on idpoly and others for details.
Try something like this —
LD = load(websave('idpoly','https://www.mathworks.com/matlabcentral/answers/uploaded_files/1248207/idpoly.mat'))
LD = struct with fields:
a: [1×0 idpoly]
a = LD.a
a = Discrete-time AR model: A(z)y(t) = e(t) A(z) = 1 + (-7.954 - 0.3i) z^-1 + (26.36 + 2.3i) z^-2 + (-45.35 - 7.6i) z^-3 + (38.88 + 13i) z^-4 + (-7.968 - 12i) z^-5 + (-8.478 + 6.2i) z^-6 + (-3.663 - 2.7i) z^-7 + (11.26 + 2.5i) z^-8 + (0.9163 + 0.051i) z^-9 + (-7.189 - 2.7i) z^-10 + (-4.175 + 0.46i) z^-11 + (12.39 + 3.7i) z^-12 + (-4.697 - 5.7i) z^-13 + (-6.017 + 3.4i) z^-14 + (6.773 + 3.6i) z^-15 + (-1.439 - 10i) z^-16 + (-1.529 + 11i) z^-17 + (1.173 - 5.9i) z^-18 + (-0.3192 + 1.7i) z^-19 + (0.0307 - 0.21i) z^-20 Sample time: 1 seconds Parameterization: Polynomial orders: na=20 Number of free coefficients: 20 Use "polydata", "getpvec", "getcov" for parameters and their uncertainties. Status: Estimated using AR ('burg/now') on time domain data (complex) "est_x1". Fit to estimation data: 100% FPE: 2.355e-25, MSE: 2.008e-25
Coefficients = a.A
Coefficients =
1.0000 + 0.0000i -7.9541 - 0.2965i 26.3582 + 2.3178i -45.3509 - 7.5709i 38.8797 +13.0764i -7.9676 -12.3483i -8.4781 + 6.1760i -3.6634 - 2.7037i 11.2582 + 2.5171i 0.9163 + 0.0513i -7.1889 - 2.6674i -4.1745 + 0.4615i 12.3895 + 3.7428i -4.6974 - 5.6726i -6.0167 + 3.4192i 6.7730 + 3.5819i -1.4387 -10.4534i -1.5295 +10.7850i 1.1733 - 5.9423i -0.3192 + 1.7405i 0.0307 - 0.2143i
Variable = a.Variable
Variable = 'z^-1'
Structure = a.Structure
Structure = A: [1×1 param.Continuous] IODelay: [1×0 double] IntegrateNoise: 0 AR model structure.
You can use the ‘Coefficients’ vector with polyval to evaluate it.
t = linspace(0, 1.5, 150);
A = polyval(Coefficients, t);
figure
plot(t, real(A), 'DisplayName','Re(A)')
hold on
plot(t, imag(A), 'DisplayName','Im(A)')
plot(t, abs(A), 'DisplayName','|A|')
hold off
grid
legend('Location','best')
.

More Answers (0)

Categories

Find more on Variables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!