File Exchange

image thumbnail

Graphical Simulation of an Elevator

version (7.73 KB) by Husam Aldahiyat
Graphical Simulation of an Elevator and its passengers.


Updated 02 Mar 2009

View License

Upon giving the number of floors as input, the elevator takes a random number of passengers and takes them up to a random floor between 2 and number of floors, before going down and picking up other passengers.

The code has extensive comments explaining how everything works.

Cite As

Husam Aldahiyat (2021). Graphical Simulation of an Elevator (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (13)

Bahar Sohaleh


i need ur files how to get it?

khaerul anwar

i see. thanks for the answer.
btw, i dont understand with the m-file. :-D
i have a task from my teacher. he ask me to make elevator that can use by people from every floor.
can you teach me how the logic that must be understanding first.

Husam Aldahiyat

It is a simplified graphical simulation which shows some graphical techniques.

Although, truth be told, in elevator simulations floor to floor travels are not of importance. See, in elevator simulation we are only interested in the peak time (when everyone in the building starts work), which occurs when the lobby is filled with passengers wanting to use the elevator to reach their designated floors.

So floor to floor travel is not important statistically anyway.

But as I said, this file simply shows some use of PATCH and how it can be applied in an animation.

khaerul anwar

what about the passenger from another floor? if he want to go to first floor??

Leo Kay

For anyone who understands elevator simulation programs this is really genius ;)


decent effort


haha, this is a good and a funny one, good job husam, keep on..


Husam Aldahiyat

The model on my computer has everything you mentioned plus more (two elevator shafts, tabulated results), but there's no need to submit it here because the working principle is the same.

Putting the basic program here would make it easier to learn (less comments and lines of code to read,plus it's basically simpler). If you were joking, then you'd edit the rating, no? ;)


i was just joking...;)

Husam Aldahiyat

It's a simple model that can be built upon. The purpose is pure educational (read: comments).


how come people in this building are only entering?
how come nobody is getting out?
how come nobody is just changing floor?
how come in this elevator nobody ever gets stuck between two floors?
I have to say i'm really dissapponted...

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

Inspired by: Move Sphere

Community Treasure Hunt

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

Start Hunting!