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

BUG: fix the Frequency Response plot of Flight class #653

Merged
merged 3 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Attention: The newest changes should be on top -->

### Fixed


- BUG: fix the Frequency Response plot of Flight class [#653](https://github.com/RocketPy-Team/RocketPy/pull/653)

## [v1.4.2] - 2024-08-03

Expand Down
25 changes: 13 additions & 12 deletions rocketpy/plots/flight_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,32 +731,33 @@ def stability_and_control_data(self): # pylint: disable=too-many-statements
ax1.grid()

ax2 = plt.subplot(212)
max_attitude = max(self.flight.attitude_frequency_response[:, 1])
x_axis = np.arange(0, 5, 0.01)
max_attitude = self.flight.attitude_frequency_response.max
max_attitude = max_attitude if max_attitude != 0 else 1
ax2.plot(
self.flight.attitude_frequency_response[:, 0],
self.flight.attitude_frequency_response[:, 1] / max_attitude,
x_axis,
self.flight.attitude_frequency_response(x_axis) / max_attitude,
label="Attitude Angle",
)
max_omega1 = max(self.flight.omega1_frequency_response[:, 1])
max_omega1 = self.flight.omega1_frequency_response.max
max_omega1 = max_omega1 if max_omega1 != 0 else 1
ax2.plot(
self.flight.omega1_frequency_response[:, 0],
self.flight.omega1_frequency_response[:, 1] / max_omega1,
x_axis,
self.flight.omega1_frequency_response(x_axis) / max_omega1,
label=r"$\omega_1$",
)
max_omega2 = max(self.flight.omega2_frequency_response[:, 1])
max_omega2 = self.flight.omega2_frequency_response.max
max_omega2 = max_omega2 if max_omega2 != 0 else 1
ax2.plot(
self.flight.omega2_frequency_response[:, 0],
self.flight.omega2_frequency_response[:, 1] / max_omega2,
x_axis,
self.flight.omega2_frequency_response(x_axis) / max_omega2,
label=r"$\omega_2$",
)
max_omega3 = max(self.flight.omega3_frequency_response[:, 1])
max_omega3 = self.flight.omega3_frequency_response.max
max_omega3 = max_omega3 if max_omega3 != 0 else 1
ax2.plot(
self.flight.omega3_frequency_response[:, 0],
self.flight.omega3_frequency_response[:, 1] / max_omega3,
x_axis,
self.flight.omega3_frequency_response(x_axis) / max_omega3,
label=r"$\omega_3$",
)
ax2.set_title("Frequency Response")
Expand Down
Loading