From a42c8d3a16f8ed1bff5ee119bab4015b97c57910 Mon Sep 17 00:00:00 2001 From: Mikhail Grushinskiy Date: Fri, 20 Sep 2024 14:49:32 -0400 Subject: [PATCH] Update TrochoidalWave.h --- bbn_wave_freq_m5atomS3/TrochoidalWave.h | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/bbn_wave_freq_m5atomS3/TrochoidalWave.h b/bbn_wave_freq_m5atomS3/TrochoidalWave.h index e81d978..3a1da93 100644 --- a/bbn_wave_freq_m5atomS3/TrochoidalWave.h +++ b/bbn_wave_freq_m5atomS3/TrochoidalWave.h @@ -7,9 +7,13 @@ */ +float trochoid_wave_displacement(float displacement_amplitude, float frequency, float t); +float trochoid_wave_vert_speed(float displacement_amplitude, float frequency, float t); +float trochoid_wave_vert_accel(float displacement_amplitude, float frequency, float t); + float trochoid_wave_length(float periodSec); -float trochoid_wave_period(float height, float accel); -float trochoid_wave_freq(float height, float accel); +float trochoid_wave_period(float displacement, float accel); +float trochoid_wave_freq(float displacement, float accel); const float g_std = 9.80665; // standard gravity acceleration m/s2 @@ -18,15 +22,26 @@ float trochoid_wave_length(float periodSec) { return lengthMeters; } -float trochoid_wave_period(float height, float accel) { - float wave_period = 2.0 * PI * sqrt(fabs(height / accel)); +float trochoid_wave_period(float displacement, float accel) { + float wave_period = 2.0 * PI * sqrt(fabs(displacement / accel)); return wave_period; } -float trochoid_wave_freq(float height, float accel) { - float wave_freq = sqrt(fabs(accel / height)) / (2.0 * PI); +float trochoid_wave_freq(float displacement, float accel) { + float wave_freq = sqrt(fabs(accel / displacement)) / (2.0 * PI); return wave_freq; } +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); +} + +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 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); +} #endif