Finding an optimal path on the terrain

Finding an optimal path on the terrain by using the forward dynamic programming algorithm.


Updated 11 Oct 2021

View License

The terrain is generated using MATLAB code from the following link:
The car must travel as close as possible to the target coordinate. The travel time should be as short as possible. The car can only move one step at a time in eight directions: left, right, up, down, up-left, down-left, up-right, and down-right.
The cost function is defined as the difference in altitude and it is always positive numbers. During the travel, the car must avoid climb trajectories. However, descent trajectories does not benefit the car either. Thus, descent trajectories are not more preferable than flat trajectories.
A more generalized version of this topic has been made available at:

Cite As

Auralius Manurung (2023). Finding an optimal path on the terrain (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2012b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes

Fixing typos.

Updated the description.

Bugs fixed on the termination critera

Added more comments.
Added new terrain data file.

Added links to download more detailed explanations.