I am trying to change the parameters for my COMSOL program using loops in MATLAB. The parameters I wanted to change were set to be taken as parameters in the model function. Once I change the parameters I have the program find results of the simulation. My problem is that in MATLAB, the graphs of the results for the different parameter combinations were looking incorrect . I put the resulting parameters directly into COMSOL Multiphysics and ran it there and the results were fine. When I looked at the compact code of the new model for those new parameters I noticed that the numbers changed in two pieces of the geometry however I'm not sure how to automate the update of these numbers in the MATLAB code. I don't want to need to rely on plugging the values into COMSOL every time.
Here is the original piece code for the first set of parameters: (% is the line that changes)
model.component('comp1').selection.create('sel2', 'Explicit');
model.component('comp1').selection('sel2').geom('geom1', 1);
model.component('comp1').selection('sel2').set([22 23 24 28 29 30 31 32 33 34 36]);
model.component('comp1').selection.create('sel3', 'Explicit');
model.component('comp1').selection('sel3').geom('geom1', 1);
model.component('comp1').selection('sel3').set([6 7 8 9 10 11 13 14 16 17 21]);
Here is the code after I change the parameters:
model.component('comp1').selection.create('sel2', 'Explicit');
model.component('comp1').selection('sel2').geom('geom1', 1);
model.component('comp1').selection('sel2').set([23 24 25 27 29 30 31 32 33 34 36]);
model.component('comp1').selection.create('sel3', 'Explicit');
model.component('comp1').selection('sel3').geom('geom1', 1);
model.component('comp1').selection('sel3').set([6 7 8 9 10 11 13 14 16 17 20]);
I could really use some help understanding where these numbers come from and how to automate the update process in a loop so I can get reliable results. Thanks!