Skip to content

Commit

Permalink
BUG: fix the Frequency Response plot of Flight class (#653)
Browse files Browse the repository at this point in the history
* BUG: fix the Frequency Response plot of Flight class
* DEV: adds #653 to CHANGELOG
* ENH: improves max_omega3 calculation
  • Loading branch information
Gui-FernandesBR authored Aug 18, 2024
1 parent e40eecc commit e81970b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
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

0 comments on commit e81970b

Please sign in to comment.