MATLAB: Extracting a signal from a model in Simulink/ SimMechanics

jointsignalsimmechanicsSimscapeSimscape Multibodysimulinkvelocity

Edited
I am new to Simulink/ MATLAB and trying to learn my way through it while doing this project. I have a pendulum that oscillates according to a supplied equation. What I want to know now is the velocity of a point on top of the pendulum (it is a solid connected to a rigid transform at connection 1 below in the pendulum block). I am trying to model a system in which this point (a magnet) would be moving over a system of coils and the length of each coil is 5 mm. I need to know the time it takes this magnet (at length L from the revolute joint) to pass over this distance at any point in its motion.
My thought was to extract the position signal from the revolute joint and use a gain and sin block to find the position of the magnet (Lsin(theta)). Then I could also take the derivative and find velocity. In order to find the time dt I tried to have the values of the position and velocity as inputs to a function block that just does diff(position) and diff(velocity) so that I can use the fact that dt = dx/dv but it didn't like the diff command. I would like to find these two differences and use them as inputs to another block that will find dx/dv. Can anyone help me with this? I am sure I explained this in a confusing way but thank you for any advice! If you have a better way to do so please advise! Thank you!

Best Answer

  • You can use the Transform Sensor block and connect it directly to a coordinate frame at the tip of the pendulum. This block outputs both velocities and positions already, so it should take care of everything :)
    - Sebastian