Repository navigation
Improved default time vector and handling for time response functions step, impulse, and initial #420
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
Merged
murrayrm
merged 11 commits into
python-control:master
from
sawyerbfuller:fix-discrete-step-response
Jul 11, 2020
Merged
Improved default time vector and handling for time response functions step, impulse, and initial #420
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b39184b
fixed default response time for time response of discrete-time functi…
sawyerbfuller 32b610b
to pass tests, added convenient ability to specify simulation time an…
sawyerbfuller 9a8da65
eliminated deprecation warnings by importing certain functions from n…
sawyerbfuller db9f197
eliminated deprecation warnings by importing certain functions from n…
sawyerbfuller 6d62910
small fix to pass unit tests
sawyerbfuller 9f02119
adjusted sisotool test so tests pass with new default step response t…
sawyerbfuller 1bc60ba
added functionality to automatically choose dt in timeresp.py based o…
sawyerbfuller 512f822
removed some leftover code and comments
sawyerbfuller 79951a1
explanation in docstrings for how time vector T is auto-computed in t…
sawyerbfuller 5a34fc0
Merge branch 'master' into fix-discrete-step-response
murrayrm e155a15
fix unit test precision in sisotool_test.py
murrayrm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ def test_sisotool(self): | |
| assert_array_almost_equal(ax_rlocus.lines[2].get_data(),initial_point_2) | ||
|
|
||
| # Check the step response before moving the point | ||
| step_response_original = np.array([ 0., 0.02233651, 0.13118374, 0.33078542, 0.5907113, 0.87041549, 1.13038536, 1.33851053, 1.47374666, 1.52757114]) | ||
| step_response_original = np.array([0. , 0.0217, 0.1281, 0.3237, 0.5797, 0.8566, 1.116 , 1.3261, 1.4659, 1.526 ]) | ||
| assert_array_almost_equal(ax_step.lines[0].get_data()[1][:10],step_response_original) | ||
|
|
||
| bode_plot_params = { | ||
|
|
@@ -59,7 +59,7 @@ def test_sisotool(self): | |
| assert_array_almost_equal(ax_mag.lines[0].get_data()[1][10:20],bode_mag_moved) | ||
|
|
||
| # Check if the step response has changed | ||
| step_response_moved = np.array([[ 0., 0.02458187, 0.16529784 , 0.46602716 , 0.91012035 , 1.43364313, 1.93996334 , 2.3190105 , 2.47041552 , 2.32724853] ]) | ||
| step_response_moved = np.array([0. , 0.0239, 0.161 , 0.4547, 0.8903, 1.407 , 1.9121, 2.2989, 2.4686, 2.353 ]) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as above. Just want to make sure I understand the need for the change. |
||
| assert_array_almost_equal(ax_step.lines[0].get_data()[1][:10],step_response_moved) | ||
|
|
||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do these values need to be changed? The system is the same and so shouldn't the step response be the same?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function in scipy that used to be used to generate the time vector,
scipy.signal.ltisys._default_response_times(A, n)usesnumpy.linspacewithout the keyword argendpoint=Falseso it returns n+1 data points instead of n. The new function does, so it generates only n data points, which is consistent with how other functions in python-control seem to do it. (thus the slightly changed values). Let me know if you have a preference to go back to n+1 datapoints. My thinking is, if you ask for n datapoints, that ought to be how many you get.