我目前正在模拟材料拉伸时的电阻响应。我有大约10个参数,我想对其中一些进行扫描研究,有时扫描1,2或4个(等)参数而不必过多地修改我的代码。
MWE:
学习功能
function result = mystudy(a,b,c,d,e)
result = a+b+c+d+e
end
主要
%study of the electric response of a material.
%parameters:
a = 3;
b = 5;
c = 11:13; %sweeping c
d = 0:1; %sweeping d too
e = 25;
%code needed to achieve the following table:
parameter_table =
3 5 11 0 25
3 5 11 1 25
3 5 12 0 25
3 5 12 1 25
3 5 13 0 25
3 5 13 1 25
for num_study = 1:size(parameter_table,1)
parameters = { parameter_table(num_study,:) };
result = mystudy( parameters{:} );
end
以这种方式进行的明显优势:
我唯一的困难是创建parameter_table,其中每一行都是将要使用的参数集。是否有一种聪明的方法来制作餐桌?