Monty Hall

Version 1.5.0.0 (2.46 KB) by Marcus
Simulate n rounds of Monty Hall problem with a variable number of doors.
2.4K Downloads
Updated 26 Apr 2010

View License

Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and the host, who knows what's behind the doors, opens another door, say No. 3, which has a goat. He then says to you, "Do you want to pick door No. 2?" Is it to your advantage to switch your choice? -Whitaker

This program demonstrates that yes, your chances of winning are improved if you switch.

Cite As

Marcus (2026). Monty Hall (https://www.mathworks.com/matlabcentral/fileexchange/26398-monty-hall), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Strategy & Logic in Help Center and MATLAB Answers
Version Published Release Notes
1.5.0.0

fixed bug where round by round mode for more than 3 doors only showed monty opening one door when in fact he opens all other doors except two

1.4.0.0

Typo correction.

1.3.0.0

Add more comments and explanation;
Very slight code modifications.

1.1.0.0

Optimized coding;
Much faster execution;
Simpler output.

1.0.0.0