modify muscle activation using known EMG

Dear AnyBody experts:

I used gait c3d motion data to drive my model and computed JRF and muscle forces under different walking conditions. The following are my steps:

  1. performing optimization and inverse dynamics (AnyBody version 6.0.3)
  2. calculate the net effective forces from muscle branches of interest using AnyForceMomentMeasure2
  3. normalize the time to gait percentage and normalize the muscle forces to the maximum force.
  4. plot the predicted muscle forces at different walking conditions (red: baseline; green: with loading), and compare the timing and shapes of the curves with EMG measures available in literature.

As shown in the attached images, muscle forces predicted at baseline seems to match EMG better. All the predicted forces are 15-20% behind the EMG, such lag seems to be too big to be explained by the disparity between CNS and muscle activation. Furthermore, although the timing of the peaks of my calculated muscle forces match two peaks of the GRF (which seems more reasonable to me), I found many other literature reporting the same pattern/timing of EMG (i.e. activated before my calculated muscle forces or first peak of GRF).

My questions are:

  1. In general, if we have EMG, how do we incorporate such information into AnyBody?
  2. if 1) is too difficult, can I change some parameters to make the muscles activate earlier?

Thank you!



If you have your EMG data then you can try to apply the AnyForceConSimpleBound class object for some muscles.

You can set LowerBound and UpperBound values of this AnyForceConSimpleBound class object using your EMG data.

Best regards,

Thanks Moonki!

If I may ask another question: is this AnyForceConSimpleBound class object to adjust the magnitude or the timing of the activity? I reviewed a couple of other models I have finished and found them consistently 0.1 s behind EMG, which is about 10% of the normal gait.


Hello Moonki:

Thanks again for the tip. Just would like to confirm with you:

It seems to me that my simulated muscle activities are 10% behind the EMG measures within normal gait. I would like to eliminate such lag. You recommended me to us AnyForceConsimpleBound to accomplish it, is that right? If so can you point me to an example or tutorial so I can try it myself?

Many thanks!


Hi Phoebe,

Attached please find an example for the constraints of muscle activations.

It will be easier for you to use ‘AnyMuscleActivityBound’ class.

I hope this may help you.

Best regards,

Thanks Moonki! Indeed this is really helpful.

Unfortunately I am not completely sure where I should put it. Can I insert AnyMuscleActivityBound in Main?

Thanks again!

oh I figured it out. Thanks a lot!

Theoretically if we are not happy w predicted muscle activities we can "fit" the experimental measures with a mathematical formula, then use that pattern as the lowerbound of the AnyMuscleActicityBound, is that correct?

For my case I am quite satisfied with the general shapes of the curves. I only want to "shift" all curves towards right to eliminate the 10-15% lag behind the EMG measures, is it possible to do that (let the muscle activate earlier)? My concerns of the approach #1 (AnyMuscleActivityBound) are: 1. it's a lot of work to get the EMG curves (either obtain the points from literature or redo the EMG analysis); 2. currently everything in the simulation looks reasonable, if I put such constraints it might change the activation of all muscles.

Thanks again for your help!


Dear Phoebe,

I thought I would throw in my 5 cents on this issue. I think what you are basically observing is that the muscle activities (force divided by instantaneous strength) estimated by AnyBody are not the same as what you measure with EMG. As I am sure you already know, going from EMG to force requires both a time delay but also involves a nonlinear mapping as well as second-order dynamics (look up some of the EMG driven models). In this case, if you wish to make a proper comparison between the estimated activities and EMG, you have to invert this relationship.

I do not think that neither putting in a lower bound on the computed muscle activities or just delaying the forces is the correct way to go about this. The forces are of course computed such that they are in agreement with dynamics of the movement according to the Newton-Euler equations and hence it is very unlikely that it is possible to just shift the forces in time and still have these equations fulfilled.

Best Regards

Dear Michael:

First of all your input is very valuable and greatly appreciated!

Regarding comparison between AnyBody prediction and EMG measures, my expectation is to be able to observe some consistencies in terms of trend (i.e., increasing vs. decreasing), shapes (i.e., monophasic vs. biphasic etc.) and patterns (activated vs. non-activated, etc.). I understand and agree that it's very difficult if not impossible to directly compare AnyBody predictions (or predictions) with EMG measurements (or measurements). I was pleased to see an overall nice agreement between predictions and measurements.

When I looked at predictions of 6 lower limb muscles, consistently between 0 to 15% gait cycle there is no muscle activation (activity or force = 0) in soleus, vastus lateralis/medialis, and rectus femoris, indicating muscles are not contracting (??) at that moment. Other muscles might have non-zero activities/muscle forces to accomplish the dynamic equilibrium. This is my primary concern with my model results because EMG clearly shows that aforementioned muscles contracted from the beginning of the gait.

I think my question has two parts:1) can I make selected muscles activate earlier (this will perfectly solve my problem), and 2) can we incorporate known EMG profiles when calculating muscle forces/activities. I think Moonki helped me with 2). Using his method (lowerbound) I can make selected muscle activities/forces in a predefined way. However, I also observed corresponding changes in other muscles to maintain the dynamic equilibrium, and I don't know if those are physiological.

Let me know what you think or if I have missed your point.

Best regard,

Dear AnyBody:

This is a follow-up with regard to my simulated muscle activities lag behind EMG measures by over 15% cycle.

As mentioned in my previous post, I was considering two options. 1) make AnyBody activate all muscles earlier or 2) use EMG as an input to define muscle activation patterns.

I still haven’t find a solution using approach 1). But I did some experiment using approach 2).

The experiment was focused on VastusLateralis because physiologically speaking, this muscle group should be activated from the start of the gait. I performed a Gaussian fit of the EMG and got a mathematical equation for VastusLateralisSuperior1. As shown in the left panel of the attached figure, blue represents the VastuslateralisSuperior1 activity predicted by AnyBody, with the first 0.1s at zero. The green curve represents the Gaussian fit of the shifted curve. Then I used the green curve as a predefined “muscle activity constraint” in AnyBody and redid the simulation. It turns out although VastusLateralis are shifted towards left (better), VastusMedialas did show much change.

I think this experiment suggests that by manipulating individual muscle activation probably won’t be an optimal solution: it will be laborious to define all the muscles and we still don’t know how these changes might affect those that are not constrained. However, it might be useful for cases including muscle atrophy etc.

If anyone can share any insight wrt how to tackle this problem (i.e. let AnyBody muscle activation start earlier) I will greatly appreciate it.


Hi Phoebe,

Let’s summarize the current status of this matter.

  1. I explained how to make some constraints on the muscle activities using AnyMuscleActivityBound class.

  2. And Michael explained the relationship between EMG and force dynamics.

  3. And you found that some muscles which are NOT constrained may give you different results from what you expect.

My suggestion is to accept the ‘difference’ between EMG and muscle force which Michael explained to you.
If you see, for instance, longer period simulation more than 1 s and if you make the comparison between EMG and the activation from AnyBody, then they may look better than this.

So if you are looking for the similar problems which have very ‘short’ cycle then you may not get what you want.

Best regards,

thanks Moonki. It's helpful!