Created
October 13, 2018 15:13
-
-
Save atnan/6473706eb041d499599dfffaac9fa10c to your computer and use it in GitHub Desktop.
Functions to convert spring parameters to and from mass/stiffness/damping and damping ratio/frequency response.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function convertDampingRatioResponseToStiffnessDamping(dampingRatio, response) { | |
let mass = 1 | |
let angularFrequency = (2 * Math.PI) / response | |
let stiffness = Math.pow(angularFrequency, 2) * mass | |
let damping = dampingRatio * (2 * Math.sqrt(stiffness * mass)) | |
return { mass: mass, stiffness: stiffness, damping: damping } | |
} | |
function convertMassStiffnessDampingToDampingRatioResponse(mass, stiffness, damping) { | |
let dampingRatio = damping / (2 * Math.sqrt(stiffness * mass)) | |
let angularFrequency = Math.sqrt(stiffness / mass) | |
let response = (2 * Math.PI) / angularFrequency | |
return { dampingRatio: dampingRatio, response: response } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment