Path: news.mathworks.com!not-for-mail From: "John D'Errico" <woodchips@rochester.rr.com> Newsgroups: comp.soft-sys.matlab Subject: Re: distance between two points along a curve Date: Sun, 9 May 2010 09:58:03 +0000 (UTC) Organization: John D'Errico (1-3LEW5R) Lines: 23 Message-ID: <hs60vb$gj6$1@fred.mathworks.com> References: <hs3e0d$cht$1@fred.mathworks.com> <hs3f5t$qh4$1@fred.mathworks.com> <hs3g9h$7u4$1@fred.mathworks.com> <hs3hs7$ika$1@fred.mathworks.com> <hs3ikh$7g9$1@fred.mathworks.com> <hs3jtp$sso$1@fred.mathworks.com> <hs3lej$6jj$1@fred.mathworks.com> <hs42df$eo0$1@fred.mathworks.com> <hs4eog$dhh$1@fred.mathworks.com> <hs4g1p$5jm$1@fred.mathworks.com> <hs4lah$756$1@fred.mathworks.com> <hs54cv$3jk$1@fred.mathworks.com> <hs582h$o0b$1@fred.mathworks.com> Reply-To: "John D'Errico" <woodchips@rochester.rr.com> NNTP-Posting-Host: webapp-05-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: fred.mathworks.com 1273399083 16998 172.30.248.35 (9 May 2010 09:58:03 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Sun, 9 May 2010 09:58:03 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 869215 Xref: news.mathworks.com comp.soft-sys.matlab:633903 "Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <hs582h$o0b$1@fred.mathworks.com>... > "John D'Errico" <woodchips@rochester.rr.com> wrote in message <hs54cv$3jk$1@fred.mathworks.com>... > > ........ > > dSdx = sqrt(1 + cos(x)^2) > > .......... > > But how do we find that point which lies at exactly > > 25 units along that curve? Easiest is just to start the > > solver at S(0) = -25. Then I'll just look for a zero > > crossing. Save this function as an m-file on your > > search path. > > ........ > > John, why wouldn't it be a lot easier to use 'ode45' to solve the differential equation > > dxds = 1/sqrt(1+cos(x)^2) > > as I mentioned earlier? Then you use s as the independent variable in 'ode45' from s = 0 to s = "desired distance", with x starting at the x value of point A. That way you don't have to go to the trouble of searching for a "crossing event" along the way. > > Roger Stafford Yes. That is a better scheme yet. John