# Emulate something in software that has a resonant frequency

1. Jan 9, 2009

### inhahe

Hello, I have a question about resonance. Say I want to emulate something in software that has a resonant frequency. It will be receiving pushes and pulls at various intervals, and I want the emulation to reflect how intensely it would vibrate at its resonant frequency as the result of those combined pushes and pulls. I think the pushes and pulls are straightforward, so my question is: What is the equation that relates how far away from the center the oscillator currently is to how strongly it's pulled back to center? I imagine this is the only relation that causes resonance in the item in question, but I don't know the math.. thanks

2. Jan 10, 2009

### Delphi51

Re: resonance

F = kx (x = distance, k a constant) should be an excellent model for the restoring force. It is used as a good approximation in pendulum and spring problems where it results in simple harmonic (sinusoidal) vibration.

3. Jan 11, 2009

### inhahe

Re: resonance

thanks. what's the relation between k and the resonant frequency?

also i have another question.. it's about the granularity in time with which i simulate this process. i honestly have no idea how crude it can be. essentially i'm wondering if i could cause a movement only every time it's pushed/pulled, and not in between, and still get the required effect.

i was thinking if i pushed according to the F=kx (plus the pushing force i'm applying), and the oscillator ends up, say, on the other side, does that really work if I simply moved it in linear relation to how strong the push was? Because meanwhile while it was moving there should have been more forces applied per position. so a) would I have to account for this (given that all i'm looking for in the end is how fast it's vibrating), and b) in that case, would it have to be accounted for step-wise, or can calculus or something be used to determine the final position after the push?

oh..as far as the calculus goes, it will be pushed at a regular interval but at varying intensities, and that interval's frequency is somewhere between twice per oscillation and a large number per oscillation.

(the pushes and pulls in real life won't happen in instantaneous pulses, but in a continuum, but i believe i can simplify for the purpose of simulation and use periodical samples..)

thanks..

Last edited: Jan 11, 2009