Make a pendulum that moves according to an equation of motion

I am trying to make a pendulum in Simulink/ SimMechanics that moves according to the equation of a damped, driven oscillator. I have been able to make the pendulum move but it oscillates for a little and dies down, just to start up again. I put a scope block in and the graph is just simply sinusoidal so I know the motion should not change like it is. I think the issue is that I am applying the force at the bottom of the pendulum (not the joint itself) and the joint is setup for motion under "automatically computed". When I change the joint so its motion is "provided by input" then I get an error that there are to many joints with manual inputs and I should try fixing it by adding joints with auto inputs. When I do that I get the same exact error. I am new to MATLAB so there is a good chance that this is a simple fix but I have no idea. Can someone please help? Thanks!
<<
<<
>>
>>

 Akzeptierte Antwort

Sebastian Castro
Sebastian Castro am 16 Apr. 2015

0 Stimmen

If your pendulum has one Revolute Joint, then you need to have either the motion input or the force input as "automatically computed". That is, you either supply a motion profile and the torque is automatically computed, or you supply a torque profile and the motion is automatically computed.
Since you're actuating the bottom of the pendulum, I'd leave the torque input of the joint to "None" and the motion to "Automatically computed". This should be fine.
One thing you can check is whether your External Force and Torque block is applied the force to the "Attached Frame" or the "World". With the former, the force might be changing direction as the pendulum moves. With the latter, the force will always point in the same global direction (I'm guessing vertically).
- Sebastian

5 Kommentare

Sebastian,
Thank you for the quick response! I tried applying the force of the External Force and Torque block to both the World and Attached frames and the same result occurs (oscillations die down and then pick up again). I am assuming this is because the force is occasionally acting against the motion thus resulting in a net force that stops the motion.
I think it makes sense to apply the equation motion directly to the motion of the joint, correct? When I tried doing this (setting the torque input to "Automatically Computed" and the motion to "Provided by Input" I no longer get the error mentioned previously, but I get the error in the screenshot below. Any ideas? Thanks again!
Sebastian Castro
Sebastian Castro am 16 Apr. 2015
Bearbeitet: Sebastian Castro am 16 Apr. 2015
Yes, that is expected. SimMechanics is picky and requires you to also specify motion derivatives (velocity and acceleration).
If you click the Simulink-PS Converter block, there are filtering options. You could apply a 2nd order filter with a time constant of, say, 0.01. Or, you could specify external input derivatives and pass the 3 signals (position, velocity, acceleration) as 3 separate inputs to the block.
EDIT: Given that you have xdot and xdotdot already computed in your model, the latter approach is probably best.
- Sebastian
Sebastian,
Thank you for the response! I apologize for my ignorance, but being new to MATLAB I am not sure how exactly to apply the 3 inputs. Am I on the right track as seen below? I know something is wrong because doing so has offset my pendulum 90 degrees. Thank you very much for all of your help so far!
That looks right. I'd check the initial conditions (State Targets) of your Revolute Joint. You can also use the Model Report to verify these initial conditions.
Also, it may be the way the shapes are set up. For example, an angle of 0 degrees actually corresponds to the pendulum starting in a horizontal setup. If so, you can add a rotation with Rigid Transform blocks so that zero matches your desired convention.
Got it! Thanks!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by