From: John D'Errico on 9 May 2010 05:58 "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <hs582h$o0b$1(a)fred.mathworks.com>... > "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hs54cv$3jk$1(a)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
From: Luca Turchet on 9 May 2010 06:07 So I followed that scheme! Could you please have a quick look and tell what do you think? Is it correct? In my opinion yes. Expecially I would need to know how to pass the parameters whithin ode. Thanks "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hs60vb$gj6$1(a)fred.mathworks.com>... > "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <hs582h$o0b$1(a)fred.mathworks.com>... > > "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hs54cv$3jk$1(a)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
From: Luca Turchet on 9 May 2010 07:04 Ok, I found the solution to pass the variables values, I needed to use global variables. Best "Luca Turchet" <tur(a)imi.aau.dk> wrote in message <hs61g7$k5b$1(a)fred.mathworks.com>... > So I followed that scheme! > > Could you please have a quick look and tell what do you think? > Is it correct? In my opinion yes. > > Expecially I would need to know how to pass the parameters whithin ode. > > Thanks > > > "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hs60vb$gj6$1(a)fred.mathworks.com>... > > "Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <hs582h$o0b$1(a)fred.mathworks.com>... > > > "John D'Errico" <woodchips(a)rochester.rr.com> wrote in message <hs54cv$3jk$1(a)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
First
|
Prev
|
Pages: 1 2 3 4 5 Prev: distance between two points along a curve Next: Matlab Engine Can't Open..... |