Calculating muscle activity

Dear Colleague,

I just made my model (gaitlowerextremity model) through a c3d file, and it runs very well until finish the inverse dynamic simulation. I am gonna compare the muscle activity from Anybody with EMG signal.

In order to make my calculation process comparable, I need to apply the same method of Anybody calculation and EMG signal in defining the muscle activity. Can anybody tell me, how does Anybody calculate muscle activity?
Let say we take the default muscle recruitment method, polynomial with p=3.

Thanks for the share

Adhi D Wibawa

Can anyone from Anybody share their knowledge on this topic?


Hi Adhi,

Sorry for the delay, there was some mix up after the holidays.
I try to answer your question:

There are several posts in the Forum and in the Wiki about EMG and muscle activity comparisons.
[FONT=Verdana]EMG is often used to validate the results of the model by comparing the activation patterns. Please remember that EMG is not exactly the same as muscle activity, so only the timing of the activation can be compared.

You can find more information about EMG validation in this paper from Mark de Zee:

And the definition of Muscle Activity (actual/maximal strength) should be in this paper:


Thanks Ali,.for the share

But, do you know, how does Anybody calculates the envelope of muscle activity? in general to get the envelope, we usually calcultaes the absolute value of the signal first, and then window averaging through the whole signal, then we have the envelope.

my second question will be:
Based on your suggestion, only the timing that can be compared to emg signal, should we compare the emg signal in whole frames or only frames when the foot steps on the plate form, so it creates a ground reaction force?

Thanks in advance


Hi Adhi,

first: The easiest way to understand the envelope is to open the ChartFX, choose any muscle and display the activity, then replace the muscle name with an *. This way you have the muscle activity of all muscles. The shape of all muscle activities is the envelope, the maximal activity of any muscle at that time.

second: it doesn’t matter if the foot touches the plates at that moment, so you can compare the activities over the whole gait.

third: it’s Amir, not Ali :wink:

Dear Amir,.

As you know that I would like to compare muscle activity from anybody with emg data from c3d file, can you explain to me, how can we define the on-set point on muscle activity that is released by anybody through inverse dynamic analysis?

(I have got all the muscle activity from anybody, but I don’t know how to define the on-set point of every muscle in Anybody)

Thanks before for sharing


Hi Adhi,

To do this you will have to make use of the logical function available in AnyBody.

If you in the reference manual search for AnyFunLogical you will get to a page describing the available functions.

There is also a link to a file where the use of the functions is illustrated, i have copied its context below.

So in your case you will have use the ltfun to check if your mus activity is larger than a certain size and if so set a new variable equal to the desired value or set it to zero if mus activation is too low.

Best regards

Main = {
  /// Equality testing
  AnyFolder Equalities = {
    AnyIntVar test1 = eqfun(1.1,0.0);
    AnyIntVar test2 = eqfun(10,10);
    AnyIntVar test3 = eqfun("dsdas","cscd");
    AnyIntVar test4 = eqfun("anybody","anybody");
  /// Not-equal testing
  AnyFolder NotEqualities = {
    AnyIntVar test1 = neqfun(1.1,0.0);
    AnyIntVar test2 = neqfun(10,10);
    AnyIntVar test3 = neqfun("dsdas","cscd");
    AnyIntVar test4 = neqfun("anybody","anybody");

  /// Not-equal testing by the not(..) function
  AnyFolder NotEqualities2 = {
    AnyIntVar test1 = not(eqfun(1.1,0.0));
    AnyIntVar test2 = not(eqfun(10,10));
    AnyIntVar test3 = not(eqfun("dsdas","cscd"));
    AnyIntVar test4 = not(eqfun("anybody","anybody"));
  /// Inequality testing
  AnyFolder Inequalities = {
    AnyIntVar lt1 = ltfun(-1.1,0.0);
    AnyIntVar lt2 = ltfun(10,10);
    AnyIntVar lt3 = ltfun(8,10);
    AnyIntVar lt4 = ltfun(10.0,8.0);
    AnyIntVar lteq1 = lteqfun(-1.1,0.0);
    AnyIntVar lteq2 = lteqfun(10,10);
    AnyIntVar lteq3 = lteqfun(8,10);
    AnyIntVar lteq4 = lteqfun(10.0,8.0);

    AnyIntVar gt1 = gtfun(-1.1,0.0);
    AnyIntVar gt2 = gtfun(10,10);
    AnyIntVar gt3 = gtfun(8,10);
    AnyIntVar gt4 = gtfun(10.0,8.0);

    AnyIntVar gteq1 = gteqfun(-1.1,0.0);
    AnyIntVar gteq2 = gteqfun(10,10);
    AnyIntVar gteq3 = gteqfun(8,10);
    AnyIntVar gteq4 = gteqfun(10.0,8.0);

  /// Combined tests using 'and' and 'or' functions
  AnyFolder AndOr = {
    AnyIntVar and1 = andfun(1,1);
    AnyIntVar and2 = andfun(1.0,0.0);
    AnyIntVar and3 = andfun(0.0,0.0);

    AnyIntVar or1 = orfun(1,1);
    AnyIntVar or2 = orfun(1.0,0.0);
    AnyIntVar or3 = orfun(0.0,0.0);
  /// if-then-else function
  AnyFolder IfThenElse = {
    AnyVar A = 1;
    AnyVar B = 2;
    AnyVar C = 3;
    AnyVar D = 4;
    AnyStringVar answer1 = iffun(ltfun(A,B), "A is smaller than B", "A is not smaller than B");

    AnyStringVar answer2 = answer1 + " and " + iffun( andfun(ltfun(A,B),gtfun(C,D)), "C is greater than D", "C is not greater than D");
};  // Main

Dear Soren,

Thanks for your reply, If I understand correctly, what you mean is, I need to make a kind of threshold of muscle activity, when the value of the signal is too low from the threshold then I should make it zero, for example.

If so, then, what is the value of the threshold?
can you tell me how do we define that?

if we compare with emg signal, we have a certain volt value to threshold the signal (to make it different between signal and noise), but for anybody signal, we don’t know how to do that.


Hi Adhi,

Sorry i can not really help you with what the threshold value should be, my guess would be 10-20%…

Best regards

Thanks Soren for the share, we had also in mind approximatelly the same range of value as you said.