There are a few reasons why "Error 5" may occur:
This error can occur when attempting to install MATLAB 64-bit on a 32-bit operating system.
MATLAB 64-bit cannot be installed on Windows 32-bit, even if your processor is 64-bit.
Corrupt Download / Antivirus Software
This error can occur if the installation files are corrupt.
Antivirus software will sometimes scan and corrupt downloaded files. you can temporarily disable any antivirus software and download a new copy of the installer.
This error can occur if the self-extractor file does not have sufficient permissions to run.
you can navigate to the folder self-extractor file and right-click on the file and select "Run as administrator". If you do not have administrator privileges, contact your IT department for further information on obtaining these privileges and installing software.
Hope this helps!