The reason will be displayed to describe this comment to others. Learn more.
Would that be enough?
See Also
markov
Notes
The :func:~control.markov command estimates the Markov parameters directly, which can be hard for slightly damped systems.
The :func:~control.observer_kalman_identification command uses a Kalman filter, which is better suited for slightly damped systems.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
All reactions
See Also
--------
markov
Notes
-----
The :func:`~control.markov` command estimates the Markov parameters directly, which can be hard for slightly damped systems.
The :func:`~control.observer_kalman_identification` command uses a Kalman filter, which is better suited for slightly damped systems.
References
----------
.. [1] J.-N. Juang, M. Phan, L. G. Horta, and R. W. Longman,
Identification of observer/Kalman filter Markov parameters - Theory
and experiments. Journal of Guidance Control and Dynamics, 16(2),
320-329, 2012. http://doi.org/10.2514/3.21006
.. [2] J.-N. Juang, Applied System Identification, 1994
Examples
--------
>>> T = np.linspace(0, 10, 100)
>>> U = np.ones((1, 100))
>>> T, Y = ct.forced_response(ct.tf([1], [1, 0.5], True), T, U)
>>> H = ct.okid(Y, U, 3, transpose=False)
"""
# Convert input parameters to 2D arrays (if they aren't already)
# Demonstrate estimation of Markov parameters via okid.
# SISO, SIMO, MISO, MIMO case
import numpy as np
import matplotlib.pyplot as plt
import os
import control as ct
def create_impulse_response(H, time, transpose, dt):
"""Helper function to use TimeResponseData type for plotting"""
H = np.array(H, ndmin=3)
if transpose:
H = np.transpose(H)
q, p, m = H.shape
inputs = np.zeros((p,p,m))
issiso = True if (q == 1 and p == 1) else False
input_labels = []
trace_labels, trace_types = [], []
for i in range(p):
inputs[i,i,0] = 1/dt # unit area impulse
input_labels.append(f"u{[i]}")
trace_labels.append(f"From u{[i]}")
trace_types.append('impulse')
output_labels = []
for i in range(q):
output_labels.append(f"y{[i]}")
return ct.TimeResponseData(time=time[:m],
outputs=H,
output_labels=output_labels,
inputs=inputs,
input_labels=input_labels,
trace_labels=trace_labels,
trace_types=trace_types,
sysname="H_est",
transpose=transpose,
plot_inputs=False,
issiso=issiso)
# set up a mass spring damper system (2dof, MIMO case)
# Mechanical Vibrations: Theory and Application, SI Edition, 1st ed.
# Figure 6.5 / Example 6.7
# m q_dd + c q_d + k q = f
m1, k1, c1 = 1., 4., 1.
m2, k2, c2 = 2., 2., 1.
k3, c3 = 6., 1.
A = np.array([
[0., 0., 1., 0.],
[0., 0., 0., 1.],
[-(k1+k2)/m1, (k2)/m1, -(c1+c2)/m1, c2/m1],
[(k2)/m2, -(k2+k3)/m2, c2/m2, -(c2+c3)/m2]
])
B = np.array([[0.,0.],[0.,0.],[1/m1,0.],[0.,1/m2]])
C = np.array([[1.0, 0.0, 0.0, 0.0],[0.0, 1.0, 0.0, 0.0]])
D = np.zeros((2,2))
xixo_list = ["SISO","SIMO","MISO","MIMO"]
xixo = xixo_list[3] # choose a system for estimation
match xixo:
case "SISO":
sys = ct.StateSpace(A, B[:,0], C[0,:], D[0,0])
case "SIMO":
sys = ct.StateSpace(A, B[:,:1], C, D[:,:1])
case "MISO":
sys = ct.StateSpace(A, B, C[:1,:], D[:1,:])
case "MIMO":
sys = ct.StateSpace(A, B, C, D)
dt = 0.1
sysd = sys.sample(dt, method='zoh')
sysd.name = "H_true"
# random forcing input
t = np.arange(0,100,dt)
u = np.random.randn(sysd.B.shape[-1], len(t))
response = ct.forced_response(sysd, U=u)
response.plot()
plt.show()
m = 100
ir_true = ct.impulse_response(sysd, T=t[:m+1])
H_true = ir_true.outputs
H_est = ct.okid(response, m, dt=dt)
# helper function for plotting only
ir_est = create_impulse_response(H_est,
ir_true.time,
ir_true.transpose,
dt)
ir_true.plot(title=xixo)
ir_est.plot(color='orange',linestyle='dashed')
plt.show()
if 'PYCONTROL_TEST_EXAMPLES' not in os.environ:
plt.show()
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.