Skip to content

Commit

Permalink
Update TrochoidalWave.h
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrouch authored Sep 20, 2024
1 parent 90730b5 commit 401fd84
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bbn_wave_freq_m5atomS3/TrochoidalWave.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,17 @@ float trochoid_wave_freq(float displacement, float accel) {

float trochoid_wave_displacement(float displacement_amplitude, float frequency, float phase_rad, float t) {
float displacement = - displacement_amplitude * cos(2.0 * PI * frequency * t + phase_rad);
return displacement;
}

float trochoid_wave_vert_speed(float displacement_amplitude, float frequency, float phase_rad, float t) {
float displacement = 2.0 * PI * frequency * displacement_amplitude * sin(2.0 * PI * frequency * t + phase_rad);
float vert_speed = 2.0 * PI * frequency * displacement_amplitude * sin(2.0 * PI * frequency * t + phase_rad);
return vert_speed;
}

float trochoid_wave_vert_accel(float displacement_amplitude, float frequency, float phase_rad, float t) {
float displacement = pow(2.0 * PI * frequency, 2) * displacement_amplitude * cos(2.0 * PI * frequency * t + phase_rad);
float vert_accel = pow(2.0 * PI * frequency, 2) * displacement_amplitude * cos(2.0 * PI * frequency * t + phase_rad);
return vert_accel;
}

#endif

0 comments on commit 401fd84

Please sign in to comment.