Parameter influence estimation using monte carlo

조회 수: 8 (최근 30일)
Nur Farahin Che Nordin
Nur Farahin Che Nordin 2024년 8월 14일
답변: Rahul 2024년 9월 2일
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
John D'Errico
John D'Errico 2024년 8월 14일
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 2024년 8월 14일
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?

댓글을 달려면 로그인하십시오.

답변 (1개)

Rahul
Rahul 2024년 9월 2일
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.

카테고리

Help CenterFile Exchange에서 Live Scripts and Functions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by