comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Newbie's question
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Newbie's question [message #45924] Wed, 19 October 2005 15:06 Go to previous message
ChiChiRuiz@gmail.com is currently offline  ChiChiRuiz@gmail.com
Messages: 32
Registered: October 2005
Member
Hi there,

I have a scatter plot which has the shape of a parabola, like y=x^2.
I want to find the best curve fit to the scatter plot, so I used the
function "curvefit" with no weights and with initial guesses (1.0, 2.0)
i.e. y = 1.*x^(2.). So, here's the problem...when I use only the right
half of the data points (i.e. x and y values are positive), I get the
curvefit returns parameter (0.5, 1.5), which means, the best fit curse
is y=.5*x^(1.75). I know the fit should be symmetric, so the same curve
SHOULD fit the other half. Now unto the left half side of the data
set, curvefit does not work anymore, and here's why, x^(1.5)=x^(3/2)
and when x is a negative number, IDL returns "NaN" because it can't
take the square root of a negative number, hence the entire procedure
will not work. I ended up having to throw away half of my data points,
and I'm not very comfortable with that. Any idea how to go around it
or suggest another function to do the same thing?

Besides, I've thought about using "polyfit", but if I remember
correctly, polyfit only takes in one x value vs. one y value. Scatter
plot has one x value vs. several y values. I don't think it'll
work in my case, but I may be wrong...

TIA (thanks in advance)

Angie
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: newbie's question
Next Topic: Re: FIX FOR FC5 SEG FAULTS

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 01:53:49 PDT 2025

Total time taken to generate the page: 0.80004 seconds