Running a Full Factorial DoE using user generated inputs

조회 수: 16 (최근 30일)
Andrew Dodd
Andrew Dodd 2015년 11월 10일
댓글: Image Analyst 2015년 11월 10일
I have written a program in which the user loads a given definition file and then runs that definition file through a series of functions to produce a desired result.
Added to this, I have made a GUI that allows the user to select certain parameters of that definition file and define a minimum value, a maximum value, and a number of steps between the two. Once the user finishes defining those selected parameters, the GUI runs the original program through each parameter range individually.
What I am trying to do is enable this GUI to run all the defined parameters simultaneously, essentially following a full factorial approach. I am having a hard time figuring out how to essentially make a self generating for loop that adds an index for each selected parameter. Anyone have any suggestions?

답변 (1개)

Image Analyst
Image Analyst 2015년 11월 10일
You mean like a nested for loop:
for p1 = p1Start : p1Step : p1End
for p2 = p2Start : p2Step : p2End
for p3 = p3Start : p3Step : p3End
out = RunExperiment(p1,p2,p3); % Do your code (call your function(s))....
end
end
end
This will do every specified combination of the 3 parameters.
  댓글 수: 2
Andrew Dodd
Andrew Dodd 2015년 11월 10일
That's what I'm trying to do, but want to be able to run between 1-45 different parameters. And it could be any value in between the two.
Image Analyst
Image Analyst 2015년 11월 10일
If you have 45 different parameters, and say each one takes on 10 values, then you'd have 10^45 different permutations. That would take a billion billion billion billion billion runs of your functions. So assuming your code runs in about a second, you could get through all of your experiments in about 7*10^38 years or about a 100 billion billion billion times the age of the universe. Are you prepared to wait that long?
For more reasonable numbers, like varying 2 or 3 parameters, you could also use meshgrid() instead of for loops. I don't know of any other way to handle varying the number of parameters you want to vary except to use all 45 in a gigantic nest and just have the ones you don't want to vary have the same starting and stopping values.

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

카테고리

Help CenterFile Exchange에서 App Building에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by