1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: Correct Dimensions to avoid numerical errors

  1. Jan 17, 2014 #1
    1. The problem statement, all variables and given/known data

    Hi, I have to do a simulation of two non linear dynamical equations which represent a electromechanical system. (An inverted pendulum attached to a cart moving over a rail). I am going to simulate the response via numerical methods programmed in LV. (I am trying firts with a variable step size RK.).
    I have 4 state variables [x,x_dot,theta,theta_dot] and Vm which is a voltage.

    2. Relevant equations

    My question is that to avoid the propagation of numerical error during the simulation one have to properly set the dimensions according to the range of variation of the variables in order to set each variable range of variation to be [-1,+1].

    If you put the x in meters, you have a range of variation of [-0.5,+0.5] or [0,1] because the rail is 1 meter long. (Also you may set that in cm or in mm, but this may led you to get more error during the iterative process of the simulation).

    Also he pendulum may rotate over the pivot for the full angle of rotation. If you set the angle (theta) in rads the range is [0,2*pi] but if you set this in degrees you then have [0,360]. The Voltage Vm could vary from 0 to 16 volts.

    3. The attempt at a solution

    I am going to try first with X in meters and Theta in radians, Vm in volts.
  2. jcsd
  3. Jan 17, 2014 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    It's not clear what you are asking.

    Solving differential equations works with the magnitudes of the measurements, not the units themselves. If you want your solution routines to work with multiple unit systems, you have to ask the user his unit preference and then adjust the step sizes in your program according to those choices.
  4. Jan 17, 2014 #3
    Sorry if I might not be as clear as I should be.

    I have this program in which I have to set the proper units of the dimensions of the problem in order to minimize the error that the simulation is going to produce. I read a paper in which it states that if the variables only vary from -1 to +1 that error is minimized. So I was asking what would you do, to establish the linear displacement in meters or mm or cm, and the angle better in radians or degrees? So it is clear that the magnitudes operated by the solver are going to be different if they are established in different units.

    Hope this helps.
  5. Jan 17, 2014 #4


    User Avatar
    Staff Emeritus
    Science Advisor
    Homework Helper

    It sounds like what you have is a scaling problem. I'm not familiar with the problem you are trying to solve, but given your four state variables, you have to find a scaling factor which keeps all of the values for these variables in the range of -1 to +1. This may or may not be possible.
  6. Jan 17, 2014 #5


    User Avatar
    Science Advisor
    Homework Helper

    Statements like that are often made, but rarely actually proved to be correct by those who make them.

    In some applications of numerical methods it seems to be "fashionable" to use scaled non-dimensional variables for everything. In other applications, nobody bothers to do it.

    Considering any cheap PC will do floating-point arithmetic to about 16 decimal places, on values with magnitudes between about ##\pm 10^{\pm 300}##, it might be worth stopping to think why that isn't "accurate enough" for what you want to do, before you start scaling anything.

    If you are simulating what happens in the time domain, I would expect the most important things affecting the errors will be (1) the numerical method you use to integrate the differential equations, and (2) the time step size of the simulation. (The two things are inter-related, of course).
  7. Jan 17, 2014 #6
    Thanks guys,

    LabVIEW has a lot of integration routines, I was thinking of trying a variable step size Runge-Kutta.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Have something to add?
Draft saved Draft deleted