hey assistent I have this def stopapproachphase(starttime, gradient): length = abs(DMAX)…
- User
hey assistent I have this def stop_approach_phase(start_time, gradient): length = abs(DMAX) / abs(gradient) x_values = np.linspace(start_time, start_time + length, FREQ) normalized_x = np.linspace(-1, 0, FREQ) scaled_atan = np.arctan(3 * normalized_x) atan_min, atan_max = scaled_atan.min(), scaled_atan.max() y_values = DMAX + (scaled_atan - atan_min) / (atan_max - atan_min) * (-DMAX)
code# Find the closest y value to G1s differences = np.abs(y_values - G1s) closest_index = np.argmin(differences) g1s_x = x_values[closest_index] if x_values[-1] - g1s_x < 1.0: x_values[-1] += 1 - (x_values[-1] - g1s_x) g1s_y = y_values[closest_index] the problem is at g1s_x if I cahnge the value of the x_values[-1] only last x_value chagnes. I want the curve to be the same from begging to the end - Assistant
To adjust the x-values so that the entire curve remains the same while ensuring that the last x-value extends to be at least 1.0 unit greater than
g1s_x, you need to scale all x-values equally rather than just adjusting the last one. By doing so, you maintain the shape of the curve. Here's how you can achieve that: - User
ok, but this dosne't modyfy also the y_Values?
- Assistant
You're correct; my previous explanation focused on modifying the to maintain the curve and extend the last while keeping the overall shape. However, if you modify the by scaling, this indirectly represents a reparameterization of your function, which can alter your to ensure they align with the new .
- User
I also need you to refind the G1s point on the graph
- Assistant