ARCSIN function


Closed Thread
Results 1 to 4 of 4

Thread: ARCSIN function

  1. #1

    Default ARCSIN function

    Is there anyway to calculate an ARCSIN in PBP? I am trying to use an accelerometer to determine velocity of an arm moving in an arc. My problem with using the direct output of the accelerometer is that it is a function of SIN. If I can convert the numbers to an angle I will have a linear relationship. Can anyone help?

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    A very good approximation is given by this polynomial.

    arcsin(x) = pi/2 - sqrt(1 - x)(a0 + a1*x + a2*x^2 + a3*x^3)

    where constant are as follow:
    a0 = 1.5707288
    a1 = -0.2121144
    a2 = 0.0742610
    a3 = -0.0187293

    Tray it and see if this polynomial will solve your problem.

    Al.
    Last edited by aratti; - 4th March 2009 at 18:30.
    All progress began with an idea

  3. #3
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    I have been thinking to a simpler way to solve your problem, and I came to the conclusion that you should use XY coordinates to trace the point on the arc where your arm moves. Your accellerometer gives you the sin value of the move than you read position zero= X0Y0 and position one = X1Y1 after the move, and so you have the possibility to linearise your data.

    You can calculate the XY coordinate with this equation:

    X= R * Sin
    Y= R * sqr(1-Sin^2)

    Where:
    R = lenght of your moving arm
    Sin = value given by accellerometer.

    This is a much simpler way to handle this data with PBP.

    Al.
    All progress began with an idea

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,615


    Did you find this post helpful? Yes | No

    Wink

    Hi,

    Centrifugal acceleration equals (-) R x Omega^2 ...

    measuring acceleration and angular speed and knowing lenghth of the arm ...

    in Ze Pocket ...


    Ok ... you must substract gravity ... Ok !

    but just need angular position ...

    correction is easy ... with a retrieve table ( LOOKUP ) that can reach up to 256 values ...


    Did I miss anything ???

    Alain
    Last edited by Acetronics2; - 5th March 2009 at 20:23.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Single button function
    By DynamoBen in forum mel PIC BASIC Pro
    Replies: 40
    Last Post: - 4th April 2020, 18:33
  2. Hash function
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 7th September 2007, 10:09
  3. Need help with write function
    By Christopher4187 in forum General
    Replies: 10
    Last Post: - 12th July 2006, 04:12
  4. ATAN2(,) function
    By vk2tds in forum PBP Wish List
    Replies: 0
    Last Post: - 25th November 2005, 02:52
  5. Random function - How to limit it ??
    By martarse in forum mel PIC BASIC Pro
    Replies: 18
    Last Post: - 30th November 2004, 14:05

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts