Parameter influence estimation using monte carlo

1 view (last 30 days)
Hi,
I have 14 parameters of groundwater, Ca, Mg, pH, Cl, NO3, TD, EC.. etc. I want to estimate the influence of each parameters for groundwater quality using monte carlo but had no idea about the coding. I try to look out for some coding but really didnt get it.
Please help
  2 Comments
John D'Errico
John D'Errico on 14 Aug 2024
How is this a question about MATLAB, except that you would like someone to teach you both about a method you vaguely describe, and about the code to perform that operation?
I would strongly suggest you first figure out exactly what and how you need to do this. Don't worry about MATLAB, about code. Then and only when you know what you need to do, should you worry about code to do it.
Sam Chak
Sam Chak on 14 Aug 2024
Please complete the following two tasks:
  1. Identify the mathematical expression that describes the relationship between groundwater quality and the 14 parameters. If the expression or equation can be expressed in closed form, you can create graphs over a defined operating range using the 'plot()' command.
  2. Define your Monte Carlo-style experiments, as they rely on repeated random sampling to obtain numerical results. How do you intend to perform random sampling? Will you impose mathematical constraints on the randomness of the sampling?

Sign in to comment.

Answers (1)

Rahul
Rahul on 2 Sep 2024
I understand that you have 14 parameters based on which you want to run the 'Monte Carlo' Simulation to estimate the influence of these parameters on the groundwater.
'Monte Carlo' estimation is based on generating random samples from your data, running your model, and analyzing the results.
You can refer to the below provided code, where I have created a simple 'Monte Carlo' linear model based on ‘mean’ estimation:️
numSimulations = 1000; % You can adjust the number of simulations accordingly
% Assuming 'data' to be the variable of Matrix containing data from all 14 parameters
% as columns.
% Monte Carlo estim
for i = 1:numSimulations
% Randomly sample indices
indices = randi(size(data, 1), size(data, 1), 1);
sampleData = data(indices, :);
% Simple model: Mean calculation
qualityIndicator = mean(sampleData, 1);
results(i, :) = qualityIndicator;
end
% Analyze and Display results accordingly
meanResults = mean(results);
stdResults = std(results);
disp('Mean influence of each parameter:');
disp(meanResults);
disp('Standard deviation of influence:');
disp(stdResults);
figure;
bar(meanResults);
hold on;
errorbar(1:length(meanResults), meanResults, stdResults, '.');
xlabel('Parameter');
ylabel('Influence');
title('Influence of Parameters on Groundwater Quality');
You can refer to the following documentations for your reference:
Hope this helps! Thanks.

Community Treasure Hunt

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

Start Hunting!