Problem 42514. The Hills Are Alive...
After a long day of coding, you decide to get some fresh air and hike up a nearby hill. The hill isn't very tall, but since you spend so much of your spare time on Cody, you aren't used to climbing, and only make it a fraction of the way up the hill before setting up camp for the night. While you're asleep, something very strange happens: the hill grows by a certain amount. Fortunately, the hill's growth is proportional, so you are higher up the (now taller) hill than you were the previous day. Undaunted, you continue climbing up the hill, determined to reach the top.
Assuming you climb the same height each day, and that the hill grows by the same amount each night, write a MATLAB script that will tell you how many days it will take you to reach the top of the hill. The inputs will be the starting height of the hill, the amount it grows each night, and how high you can climb each day.
Example - The hill starts off at 200 meters tall, and you climb up 50 meters before setting up camp. At the end of day 1, you're 50 meters up a 200 meter hill. The hill grows 100 meters that night while you're asleep. At the start of the second day, you're now 75 meters up a 300 meter hill. You climb another 50 meters, putting you 150 meters up the hill. That night, the hill grows another 100 meters. This procedure continues until the 10th day, when you finally reach the summit of a now 1100 meter "hill."
Here, height=200, daily_growth=100, and climb=50. The output of your script should be d=10.
Solution Stats
Problem Comments
-
5 Comments
The mathematical background required to solve correctly this problem is too high for me.
i've got correct answers in matlab. here i've got only 'Failed to evaluate' :c
I'm guessing there's a toolbox you have that isn't on Cody. Other people (myself included) have run into issues like that.
Jean-Marie Sainthillier,I agree with you
I feel like the statement doesn't go a good job of explaining the problem properly.
How does 50 become 75? 75+50=150, in the example given.
Solution Comments
Show commentsProblem Recent Solvers11
Suggested Problems
-
25756 Solvers
-
Sort a list of complex numbers based on far they are from the origin.
5683 Solvers
-
270 Solvers
-
49 Solvers
-
439 Solvers
More from this Author80
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!