help-octave
[Top][All Lists]

Curve Fitting "splattered" data

 From: Robert A. Macy Subject: Curve Fitting "splattered" data Date: Sun, 17 Oct 2004 23:36:10 -0700

```Trying to fit a curve to data with poor results.

Data is a set of 37 complex data points that roughly lie
along a straight line in the complex plane.  Sequence of
data has no significance, only their location on the plane.

Don't care about intercept point, only the slope.  Ran
polyfit.m using  real(datapoints) and imag(datapoints)
thinking that would yield slope of trend, for example,

p=polyfit(real(datapoints),imag(datapoints),1)

calculates a slope, but when I reverse the order

p=polyfit(imag(datapoints),real(datapoints),1)

I don't get a reciprocal slope?!

one way I get 15.093, the other way I get 0.0228387
Why aren't they reciprocal?

Is there a better program for finding the straight line?

- Robert -

here are the 37 data points
(-2.1456286465351e-05,0.000368384340354591)
(-2.49666512943912e-05,0.000406964922352655)
(-2.69240185786467e-05,0.000364390858984563)
(-1.49721995852635e-05,0.000755348867291811)
(-1.90168461047455e-06,0.000910735448537009)
(3.89911415063851e-06,0.000656777869028222)
(-1.74228809964004e-05,0.00059494106144057)
(-1.84452460767724e-05,0.000497123085040872)
(-6.73652063290162e-06,0.000408316846438543)
(-2.02781429825792e-05,0.000157306074676664)
(-7.79168094935598e-06,0.000112567966979171)
(1.19220050194026e-05,7.87631929476673e-05)
(-2.22440748356631e-06,-7.30142650390078e-05)
(-5.18669954210557e-06,-0.000103332769797446)
(-1.50579444382556e-06,-0.0001394015627003)
(7.15256667891198e-06,-0.000158813587520262)
(1.61581810444768e-05,-0.000146061331035827)
(-1.27343429541481e-05,-0.000114864732620068)
(-5.46509907308965e-06,-0.000188387643769827)
(1.33219143418663e-05,-0.00017258920713193)
(1.42599281056401e-05,-0.000164717680570664)
(-5.09652523452905e-06,-0.000254209182844856)
(-2.36118248311476e-06,-0.00029107521541287)
(1.08747988875925e-05,-0.000225779565913714)
(-8.66620629948883e-07,-0.000360194241635699)
(1.23374719256143e-05,-0.000386204823149286)
(1.1660501015618e-05,-0.000323737080074195)
(1.98258461605351e-05,-0.000237412110197996)
(1.72411954988162e-05,-0.000203562685617997)
(1.30671392031025e-05,-0.000134361950454388)
(1.52025452697414e-05,-0.000209740338777707)
(-1.50070064195672e-05,-0.000152806222347181)
(1.06122634539775e-05,-0.000104056738370627)
(1.21213670163135e-05,-0.000237839370940948)
(1.56642065274083e-05,-0.000417574958985853)
(7.52983564631174e-06,-0.00034448159389109)
(-1.50788950994615e-06,-0.000167401675272537)

-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------

```