Formula integration

May 4, 2011 at 9:50am

Formula integration

Hallo together,

I want to integrate this formula in Max:

Î” L in dB = 20 Ã— log (Distanc r2 / Distanc r1)

which object can I use to achieve the result of this calculation.

#56844
May 4, 2011 at 6:26pm

I would say look into the [expr] object. Something like this probably: [expr 20 * log(\$f1 / \$f2)]

and if you still need to calculate the distance r2 and r1: [expr sqrt((pow((\$f1 - \$f3),2) + pow((\$f2 - \$f4) ,2)))] where \$f1 and \$f3 are r1.x and r2.x and \$f2, \$f4 = r1.y and r2.y

I think that should work (none of those are tested in max), but then again, my math skills aren’t all that polished ;)

#203768
May 4, 2011 at 6:34pm

Expr will do it, but you need to use log10 instead of log (log is natural log).

Might as well use vexpr, though since if you ever need to process lists of distances, you can do all your calculations in one place…

vexpr 20.*(log10(abs(\$f1/\$f2))) @scalarmode 1

#203769
May 5, 2011 at 8:58am

That works great, I am happy! Thank you very much.

#203770

You must be logged in to reply to this topic.