The solution here is a catenary curve, which is not a parabola ... but even with that in mind, I am getting different answers.
I put it there thinking this way...
if the ground clearance > height -- that is an invalid scenario.
but if the height of the poles and ground clearance are equal--then u cannot get a parabola type curve(more precisely a catenary curve) i.e. a hanging cable if u make d=length of the cable.
yet still I think d=length can be considered as the right solution.
is that the answer u're getting - @william?
If you accept a parabola as the solution, then the correct answer to problem 3 is d=length=200. David is pointing out that the answer given in the test suite is 0, not 200. From my point of view, though, the parabola is not a correct solution. The catenary curve looks superficially like a parabola, but it is significantly different. In fact, only 2 of the 3 input parameters are required to specify the catenary curve. In problem 3, for example, if you specify the pole heigth and the clearance as being the same, there is no solution; but if you specify the cable length and the clearance, there is a solution and it is less than the cable length.
the shape of the hanging cable is of a catenary curve.
the ground clearance is added to look into the problem logically.
but I think I've made a blunder regarding the calculation with clearance.
I'll update the test suites.
Oh no! I thought I understood this problem, but I see that I don't. Do you have a ground clearance in addition to the natural clearance of the catenary y=a*cosh(x/a)? In that case, I guess we *do* need 3 input parameters. If that is not the case, then the cable length can't be more than twice the height h.
yes,1st I actually intended to do that way -- a ground clearance in addition to the natural clearance of the catenary.
but I jumbled up my equations there.
i'll try to fix the bugs of this problem soon.
Meanwhile would u kindly elaborate ur last line
Yes, what I was trying to say is that if the only clearance is that which is provided by the catenary curve y=a*cosh(x/a) itself, then you are not allowed to specify a cable length that is more than twice the height of the poles. That is because there will be some (typically small) values of pole separation at which the cable will hit the ground. It's not that there would not be a larger value of pole separation at which the cable had the specified length. A solution would undoubtedly exist. It's just that having the cable lying on the ground for small separation would introduce some ambiguity about the problem. The only way to avoid this, for long cables, would be to add an additional clearance that was large enough to keep the cable off the ground even when the pole separation went to zero. Anyway, I noticed that some of the current test problems violate this rule, and would require a third input parameter that specifies what the added clearance is.
As said by William, the curve is a catenary. Unless you are familiar with such type of curves, it is best to read about them first.
Test 3 seems obviously wrong. I believe I am determining the focal length of the parabola correctly, but my answers are not agreeing perfectly with yours.
Add two numbers
Replace all zeros and NaNs in a matrix with the string 'error'
Moving average (variable kernel length)
frame of the matrix
Number of digits in an integer
The Tortoise and the Hare - 01
Find the treasures in MATLAB Central and discover how the community can help you!
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office