Path: news.mathworks.com!not-for-mail
From: Loren Shure <loren@mathworks.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: River miles
Date: Wed, 19 Nov 2008 17:22:07 -0500
Organization: The MathWorks
Lines: 117
Message-ID: <MPG.238e5b999c15195a9898f5@news.mathworks.com>
References: <gfst52$caq$1@fred.mathworks.com> <90f017a9-906d-4c7d-8ac5-7167e15e0d8c@u18g2000pro.googlegroups.com> <01d3cdd8-c83e-47bc-9357-fb97949f0eff@r40g2000yqj.googlegroups.com> <gg22tm$k2v$1@fred.mathworks.com>
NNTP-Posting-Host: shurel.dhcp.mathworks.com
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-15"
Content-Transfer-Encoding: 7bit
X-Trace: fred.mathworks.com 1227133327 25667 172.31.57.200 (19 Nov 2008 22:22:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 19 Nov 2008 22:22:07 +0000 (UTC)
User-Agent: MicroPlanet-Gravity/2.70.2067
Xref: news.mathworks.com comp.soft-sys.matlab:501871


In article <gg22tm$k2v$1@fred.mathworks.com>, sinusoid2@hotmail.com 
says...
> Rune Allnor <allnor@tele.ntnu.no> wrote in message <01d3cdd8-c83e-47bc-9357-fb97949f0eff@r40g2000yqj.googlegroups.com>...
> > On 19 Nov, 21:42, "Travis" <sinuso...@hotmail.com> wrote:
> > > Rune Allnor <all...@tele.ntnu.no> wrote in message <f36d9204-1e90-4b53-b6=
> > f2-6d1b6ecb1...@i18g2000prf.googlegroups.com>...
> > > > On 18 Nov, 16:13, "Travis" <sinuso...@hotmail.com> wrote:
> > > > > Rune Allnor <all...@tele.ntnu.no> wrote in message <6875d2af-8eb2-443=
> > a-a8=3D
> > > > 31-d4c1773c1...@c36g2000prc.googlegroups.com>...
> > >
> > > > > =3DA0Rune the river was mapped using a GPS that recorded time, posiio=
> > n, and=3D
> > > > =A0heading each time the heading changed. =3DA0It was then interpolated=
> >  so that=3D
> > > > =A0data taken between heading chages have unique lat/long values. =3DA0=
> > Are you =3D
> > > > suggesting that I break the river up into segments that do not double b=
> > ack =3D
> > > > on themselves
> > >
> > > > Yes. Use the segments between consecutive (lat,long) points
> > > > as basis.
> > >
> > > > > and use interp1 on each segment?
> > >
> > > > No. Interpolate the whole curve.
> > >
> > > > >=3DA0I have a 60 mile stretch of river to do this for. =3DA0
> > >
> > > > No need to do that manually. The idea is to sort
> > > > the data not according to lat or long, but according
> > > > to travelled/accumulated distance.
> > >
> > > > The distance serves as a parameter, and so the
> > > > (lat, long) path becomes an arbitrary parametric
> > > > curve in the plane. Once you see this basic idea
> > > > the rest is (almost) trivial.
> > >
> > > > Rune
> > >
> > > What coding would I use in this instance?=96 Skjul sitert tekst =96
> > >
> > > =96 Vis sitert tekst =96
> > 
> > Don't know what you mean by coding, but here's an example:
> > 
> > %   lat        long     dist
> > d =3D[0.0081    0.9128         0
> >     0.1340    0.9210    0.9307
> >     0.2437    0.9485    1.9100
> >     0.3660    0.9609    2.9382
> >     0.5027    0.9581    4.0202
> >     0.5836    0.9375    5.1245
> >     0.6106    0.9114    6.2216
> >     0.6178    0.8592    7.2798
> >     0.5567    0.7837    8.2410
> >     0.4344    0.7658    9.1215
> >     0.2671    0.7782    9.9442
> >     0.1736    0.7919   10.7549
> >     0.0872    0.7617   11.5215
> >     0.0854    0.6985   12.2252
> >     0.1178    0.6738   12.9092
> >     0.3300    0.6078   13.6008
> >     0.4308    0.6147   14.3514
> >     0.6106    0.6490   15.2426
> >     0.7383    0.6834   16.2486
> >     0.8714    0.7012   17.3671
> >     0.9379    0.6463   18.5062
> >     0.9397    0.5968   19.6194
> >     0.9074    0.5391   20.6749
> >     0.8444    0.5364   21.6753
> >     0.7167    0.5474   22.5771
> >     0.5800    0.5776   23.3957
> >     0.4829    0.5254   24.1093
> >     0.3804    0.4512   24.6995
> >     0.3768    0.4045   25.2524
> >     0.4272    0.3674   25.8158
> >     0.5495    0.3633   26.4745
> >     0.6214    0.3743   27.2000
> >     0.7581    0.3565   28.0377
> >     0.7923    0.3207   28.8924
> >     0.7815    0.2507   29.7131
> >     0.7131    0.1655   30.4452
> >     0.5585    0.1669   31.0281
> >     0.4937    0.1875   31.5562
> >     0.3678    0.2026   31.9761
> >     0.2653    0.1806   32.2970
> >     0.2149    0.1133   32.5400
> >     0.2941    0.0680   32.8418
> >     0.4200    0.0694   33.2675
> >     0.5387    0.0556   33.8090];
> > 
> > % Plot the river path
> > subplot(2,1,1)
> > plot(d(:,1),d(:,2))
> > 
> > % Plot the lat and long vs distance
> > subplot(2,1,2)
> > plot(d(:,3),d(:,1),'b',d(:,3),d(:,2),'r')
> > 
> > Now you can interpolate both lats and longs with
> > respect to distance, and maybe be able to go on
> > from there.
> > 
> > Rune
> 
> You are forgetting that even interpolating to either lat or long has a problem...there are mulitple river miles for numerous lats/longs, and matlab does not like that.  
> 

What Rune meant, and should work, is to separately interpolate lat vs. 
dist and long vs. dist, with dist the independent variable.  Then you 
should have new matching arrays for lat and long.

-- 
Loren
http://blogs.mathworks.com/loren