options for analyzing simulation results. Looking for suggestions

4 views (last 30 days)
I have developed a Markov Model and got 100000 simulations for a time period of 57 years. That means my output is 100000 by 57 matrix.
Now I want to use analyze the results of those simulations by using various graphical forms. I have not used MATLAB much before, therefore, I am looking for the suggestions for graphs/plots/figures that can give meaningful visualization of the simulations.
I have used following command which works perfectly for a small number of simulations but the results look clumsy to make any analysis. Any suggestions?
plot(timePeriod,simulations(1,1:end))

Answers (1)

Parag
Parag on 31 Jan 2025 at 12:51
To visualize a large set of simulations from a Markov Model like 100000 simulations for 57 years there are several techniques and plots that can help you gain insights from your data.
Here’s a complete MATLAB script that initializes a random dataset and demonstrates various visualization techniques for analyzing the results of 100,000 simulations over 57 years.
% Initialize random data for simulations
numSimulations = 100000; % 100,000 simulations
numYears = 57; % 57 time steps
timePeriod = 1:numYears; % Time axis (1 to 57 years)
simulations = randn(numSimulations, numYears); % Random normal distributed data
% 1. Plot the mean of all simulations over time
figure;
meanSim = mean(simulations, 1);
plot(timePeriod, meanSim, 'b', 'LineWidth', 2);
title('Mean of Simulations Over Time');
xlabel('Time (Years)');
ylabel('Mean Value');
grid on;
% 2. Boxplot for distribution at each time step
figure;
boxplot(simulations, 'Labels', string(timePeriod));
title('Distribution of Simulations at Each Time Step');
xlabel('Time (Years)');
ylabel('Simulation Values');
set(gca, 'XTickLabelRotation', 45); % Rotate labels for better visibility
% 3. Heatmap for visualizing the trends
figure;
imagesc(simulations);
colorbar;
title('Heatmap of Simulations Over Time');
xlabel('Time (Years)');
ylabel('Simulation Index');
set(gca, 'YDir', 'normal'); % Ensures proper orientation
% 4. Histogram of the final state values (last column)
figure;
histogram(simulations(:, end), 50, 'FaceColor', 'g', 'EdgeColor', 'k');
title('Distribution of Final State Across Simulations');
xlabel('Final State Value');
ylabel('Frequency');
grid on;
You can check the documentation of plots in MATLAB for more details on the types of plots in MATLAB.
You can also include waterfall plot as described in one of the MATLAB answers.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!