The following Matlab project contains the source code and Matlab examples used for variance decomposition. How much in variability of some variable is contributed by variance of each shock separately. So far is for fixed number of shocks. You can change this number in the code.
The source code and files included in this project are listed in the project files section, please make sure whether the listed source code meet your needs there.