Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow passing and saving of params in time responses #982

Merged
merged 1 commit into from
Mar 31, 2024

Conversation

murrayrm
Copy link
Member

This PR allows parameter values to be saved in time responses as well as passing parameter values (via the params keyword) for the initial_response, ,step_response, and final_response functions (which call through to input_output_response for nonlinear I/O systems).

With this functionality, you can do things like

    nlsys = ct.nlsys(
        lambda t, x, u, params: params['a'] * x[0] + u[0],
        states = 1, inputs = 1, outputs = 1, params={'a': 0})
    timevec = np.linspace(0, 1)
    resp = step_response(nlsys, timevec, params={'a': -0.5})

The simulation will run with params['a'] = -0.5 and this information will be stored in resp.params.

@coveralls
Copy link

coveralls commented Mar 30, 2024

Coverage Status

coverage: 94.449% (+0.02%) from 94.425%
when pulling 85568a9 on murrayrm:save_params-30Mar2024
into 4d878a9 on python-control:main.

@murrayrm murrayrm added this to the 0.10.0 milestone Mar 31, 2024
@murrayrm murrayrm merged commit c8d9c8f into python-control:main Mar 31, 2024
23 checks passed
@murrayrm murrayrm deleted the save_params-30Mar2024 branch March 31, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants