[PD] msd change mass of mass

Charles Henry czhenry at gmail.com
Sun Mar 16 01:12:32 CET 2008


I have forgotten some things here.  That's why it took so long, but I
think I've got it mostly right.

There are two type of mass spring systems, depending on what kind of
input you have.

force-driven: such as a loudspeaker--the coil induces a force on a
permanent magent.

velocity driven: a crankshat-piston assembly--rotates with a fixed
speed;classic problems for vibration isolation.

but I'm only going to cover the first one here.

these two type of inputs are similar to electronic circuits: a voltage
source (force) and a current source (velocity)

so, a mechanical circuit would look like:

 |-----(M)---(S)----(D)---|
(F)                          |
 |----------------------------|

all in series

Suppose our output is the velocity.

F=m*a  (the force on a mass is in the same direction as its acceleration)
F=c*v  (the damping force is in the opposite direction of velocity)
F=k*d  (the spring force is in opposite direction of displacement)


F(t)=m*dv/dt + c*v + k*integral(t0 to t, v*dt)
Laplace transform:
F(s)=(m*s+c+k/s)*V(s)

And the transfer function:

F(s)                   1/k*s
------ = --------------------------------------
V(s)       (m/k)*s^2 + (c/k)*s + 1

And there are three cases:  underdamped, critically damped, and over damped
(I'm not sure how to do the z-transform for a critically damped
system, but I think we can figure it out).

poles:
-0.5*c/m  +/- 0.5*sqrt( (c/m)^2 - 4k/m )
zero:
0

Note, when c goes to 0, we get a harmonic oscillator at angular
frequency w=k/m rad/sec, which is correct.  When we increase the
damping, we get terms of e^(-0.5*c/m*t) which damps the solution.


Under-damped case (the resonant system):
(c/m)^2 - 4k/m < 0


I'm reluctant to try to use a bi-linear tranform, here.  I'd like to
look it up in a table!  I've worked through these problems before, but
I can't remember what you do differently with the numerator... I think
it indicates a mixture of sines/cosines.

z-transform of
(s+a)/ ((s+a)^2 + b^2)   is
(1 - z^(- 2)*e^(-aT)*cos(b*T) ) / (1 - z^(-1)*e^(-aT)*cos(b*T) +
z^(-2)*e^(-2*a*T) )

T is 1/fs, our sample rate

z-transform of
1/((s+a)^2 + b^2)          is

1/b * z^(-1) * e^(-aT)*sin(b*T) / (1 - z^(-1)*e^(-aT)*cos(b*T) +
z^(-2)*e^(-2*a*T) )


so, s/ ((s+a)^2 + b^2)   is

(1 - a/b * z^(-1) * e^(-aT)*sin(b*T) -  z^(- 2)*e^(-aT)*cos(b*T) ) /
(1 - z^(-1)*e^(-aT)*cos(b*T) + z^(-2)*e^(-2*a*T) )

In our case, a=0.5*c/m and b=0.5*sqrt( abs((c/m)^2 - 4k/m ))

and our biquad coefficients are:
ff1=1
ff2= -a/b*e^(-aT)*sin(b*T)
ff3= -e^(-aT)*cos(b*T)
fb1=e^(-aT)*cos(b*T)
fb2=-e^(-2*a*T)

I've put together a little patch, calculator and example biquad.  This
took a little more time than I expected, and I'm running out of steam
here.  Try it out, and see if it's what you had in mind.

There are two more cases to cover, but this is probably the one you
want.  I may come back to this later....


Chuck

On Sat, Mar 15, 2008 at 3:09 PM, marius schebella
<marius.schebella at gmail.com> wrote:
> yes, I was talking about an external called msd.
>  I am not sure if biquad~ or fexpr~ can help. Is it possible to create
>  harmonic sounds by sending impulses into a biquad~? that would really
>  help. right now I am playing with msd in a block~ 1 subpatch, which is
>  not very efficient.
>  marius.
>
>
>
>  Charles Henry wrote:
>  > Are you talking about some kind of mass, spring, damper equation?
>  >
>  > We could write such a thing with just a biquad~ or fexpr~, if that
>  > makes life easier.  It's just a little bit of math.
>  >
>  > Chuck
>  >
>  > On Sat, Mar 15, 2008 at 1:32 PM, marius schebella
>  > <marius.schebella at gmail.com> wrote:
>  >> hi,
>  >>  is someone working on msd? I wonder why it is not possible to change the
>  >>  mass of a mass dynamically with something like [setMass m1 1.5(
>  >>  is this function not supported because it is not possible, or just
>  >>  because it was not implemented yet.
>  >>  marius.
>  >>
>  >>  _______________________________________________
>  >>  PD-list at iem.at mailing list
>  >>  UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
>  >>
>  >
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mass_spring_damper.pd
Type: application/octet-stream
Size: 3163 bytes
Desc: not available
URL: <http://lists.puredata.info/pipermail/pd-list/attachments/20080315/9e184806/attachment.obj>


More information about the Pd-list mailing list