How to couple Matlab to other model for monte carlo simulations??
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi,
I am using Hydrus to simulate 1D unsaturated water flow. I would like to create a matlab file that can call the hydrus .exe, run the program with a set of parameters, save the output, then run the program again with another set of paramters, save, etc. I have run monte carlo simulations in .m files before (like below), but I don't know how to call another program, run the MC iteration, save, and repeat. Any guidance on how to script this would be appreciated!!!
Thanks
MC_Iterations=10000; %number of monte carlo iterations
for i=(1:MC_Iterations) %uniform distribution between low/high end members of MC ranges
vGAlpha = unifrnd(0.00001,110); %Range of Van Genuchten Alpha values
n = unifrnd(0.00001,110); %Range of Van Genuchten n values
SatK = unifrnd(0.00001,110); %Range of saturated hydraulic conductivity values
LongDisp = unifrnd(0.00001,110); %Range of longitudinal dispersivity values
Kd_solid = unifrnd(0.00001,110); %Range of solid phase sorption values
KineticAlpha = unifrnd(0.00001,110); %Range of time dependant solid phase sorption vlues
Kd_awi = unifrnd(0.00001,10); %Range of air water interfacial sorption values
end
댓글 수: 0
답변 (1개)
dpb
2022년 5월 3일
That all depends on how the other application reads/writes its input/output. If it uses files and you can specify the input/output files and simply writing those output files for later post-processing is sufficient, it's pretty straightforward.
If it's interactive user input, it's a lot more complicated if doable at all...
We don't have sufficient info to respond in detail, but the basic idea will be to write a string that you pass to the OS to dispatch the other code with system()
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!