Updating Parameters in MATLAB COMSOL Using Loops Giving Different Results than normal COMSOL

9 views (last 30 days)
Marissa Whitby
Marissa Whitby on 15 Oct 2021
Edited: Marissa Whitby on 15 Oct 2021
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 (see attached picture, blue center should be together). When I plugged the same parameters directly into the COMSOL program and ran the simulation in COMSOL the graphs were just fine (see attached, blue is in center as needed). This is strange to me because I downloaded "Compact History" version of the original COMSOL simulation to MATLAB and then updated the parameters as follows:
%convert values to string so we can use them in parameter updates
SIO2_str = num2str(SIO2_val);
Electrode_gap_str = num2str(Electrode_gap_val);
Electrode_height_str = num2str(Electrode_height_val);
%adding units
unit = '[um]';
SIO2_input = strcat(SIO2_str,unit);
Electrode_gap_input = strcat(Electrode_gap_str, unit);
Electrode_height_input = strcat(Electrode_height_str, unit);
model.param.set('Electrode_height', Electrode_height_input, 'height of electrode');%**
model.param.set('Electrode_gap', Electrode_gap_input, 'Gap between electrodes'); %**
model.param.set('Electrode_sidewall_height', SIO2_input);% ****
I even downloaded the "Compact History" for the simulation after directly entering the new parameters and it looked identical to the original "Compact History" code that I had updated with the exception of the parameter values. Any suggestions on how to fix this?

Answers (0)

Community Treasure Hunt

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

Start Hunting!