Update prescribed force

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ana de Sousa
Posts: 13
Joined: Thu Apr 07, 2016 4:21 pm

Update prescribed force

Post by Ana de Sousa » Tue Apr 16, 2019 5:48 am

Hello, if anyone could help me with this topic.

I am able to create this force (at the model), but I do not know how I change it in Matlab, during forward simulation

Code: Select all

% Create force
pelvis_Force = PrescribedForce(pelvis);

pelvis_Force.setName('pelvis_force');
pelvis_Force.setForceFunctions(Constant(0), Constant(250), Constant(0));

% Add the force to the model
osimModel.addForce(pelvis_Force); % Add the force to the model
How can I get this pelvis_Force and change its ForceFunction during simulation?

Tags:

User avatar
James Dunne
Posts: 1204
Joined: Thu Oct 04, 2007 11:51 pm

Re: Update prescribed force [Matlab script]

Post by James Dunne » Tue Apr 16, 2019 6:24 am

You would be better off to use ExternalForce(). You would create a time history of the force vector and location then add that to add it to the model.

User avatar
Ana de Sousa
Posts: 13
Joined: Thu Apr 07, 2016 4:21 pm

Re: Update prescribed force

Post by Ana de Sousa » Wed Apr 17, 2019 6:06 am

Thanks for the response.
So, is it a prescribed force? Is there a way to make it dependable to another variable? In a way that I could change it dynamically? (similarly to the way that we can do to a torque in a joint)

User avatar
James Dunne
Posts: 1204
Joined: Thu Oct 04, 2007 11:51 pm

Re: Update prescribed force

Post by James Dunne » Wed Apr 17, 2019 7:55 am

So, is it a prescribed force?
No, it is an external force. They are different. I suggested that because you can assign the location of the point over time. However, I do see now that PrescribedForce() has a method for assigning a pointFunction(), so you just need to define the function you want for location over time.

User avatar
Ana de Sousa
Posts: 13
Joined: Thu Apr 07, 2016 4:21 pm

Re: Update prescribed force

Post by Ana de Sousa » Thu Apr 18, 2019 7:14 am

Both options (prescribed and external) are only defined by functions over time?
Is there a way to make it defined over another variable, for example?

For example, something like "if the knee joint is higher than 45 deg, force = 10, otherwise force = 0"?

POST REPLY