Searching \ for '[OT] Mathematical question' in subject line. ()
Help us get a faster server
FAQ page: www.piclist.com/techref/method/math.htm?key=math
Search entire site for: 'Mathematical question'.

Exact match. Not showing close matches.
'[OT] Mathematical question'
1999\12\05@022211 by

This might seem waaay OT but there is a PIC in there somewhere.

I've been given information as such:
if x=0, y=0
x=15, y=0.259
30, 0.5
45, 0.707
60, 0.866
75, 0.966
90, 1.000

You will see that while X is linear, Y is not (Log??). With these
information available, how would I calculate Y for all the other values
of X?

I want to use it in a lookup table in the PIC.

Thanks
Quentin

Quentin,

What you want depends on whether your question is specific or general and
how accurate you want the result.
What you have described is the results for Y = Sin(X)
X in degrees.

You can calculate this using a Sin function.
If you are using assembler such routines are available.
If you are using C or BASIC or some other high level language then the
function is (probably) already available in the language.

If this is a general question then the normal method is "interpolation".
Linear interpolation is the simplest form of this and generally the least
accurate but may be OK for your purpose.

Before we go into this it would be useful for you to provide some more
information eg
- Are you after Sin (as shown here) or is the question more general?
- What accuracy do you need?
- What is the application?

regards

Russell McMahon
_____________________________

>From other worlds - http://www.easttimor.com
http://www.sudan.com

What can one man* do?
Help the hungry at no cost to yourself!
at  http://www.thehungersite.com/

(* - or woman, child or internet enabled intelligent entity :-))

From: Quentin <qscICON.CO.ZA>

{Quote hidden}

On Sun, 5 Dec 1999 09:24:25 +0200 Quentin <qscICON.CO.ZA> writes:
>This might seem waaay OT but there is a PIC in there somewhere.
>
>I've been given information as such:
>if x=0, y=0
>x=15, y=0.259
>30, 0.5
>45, 0.707
>60, 0.866
>75, 0.966
>90, 1.000
>
>You will see that while X is linear, Y is not (Log??). With these
>information available, how would I calculate Y for all the other
>values
>of X?
>
>I want to use it in a lookup table in the PIC.

Well, I HAVE done a 7th order power series by solving 7 equations with 7
unknowns (the coefficients).  It worked, but was a lot of trouble.
Last time, I used a standard curve fitting program (Curve Expert).  Jack
Crenshaw mentions a bunch of them in the December issue of Embedded
Systems Programming.  Here are the ones he lists:

http://www.micromath.com/scientist.html
http://www.spss.com
http://www.ebicom.net/~dhyams/cvxpt.htm

Harold

___________________________________________________________________
Why pay more to get Web access?
Try Juno for FREE -- then it's just \$9.95/month if you act NOW!
Get your free software today: dl.http://www.juno.com/dynoget/tagj.

> This might seem waaay OT but there is a PIC in there somewhere.

> I've been given information as such:
> if x=0, y=0
> x=15, y=0.259
> 30, 0.5
> 45, 0.707
> 60, 0.866
> 75, 0.966
> 90, 1.000

> You will see that while X is linear, Y is not (Log??). With these
> information available, how would I calculate Y for all the other values
> of X?

This is a sine function. Y = sin(X). You can do it on your calculator or
look it up in a book of tables.

> I want to use it in a lookup table in the PIC.

Somewhere I've seen a application that does exactly this to generate a
pseudo-sine wave for audio testing.  If I can find it I'll post a pointer.

.

This is the sin function.

Quentin wrote:

{Quote hidden}

Hi,

the equation is: y =  sin(x)

I hope this helps.

Imre

On Sun, 5 Dec 1999, Quentin wrote:

{Quote hidden}

Thanks All
Told you my brain is rusted.

Quentin

More... (looser matching)
- Last day of these posts
- In 1999 , 2000 only
- Today
- New search...