Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.
Updating Parameters in MATLAB COMSOL Using Loops Giving Different Results than in COMSOL
Posted 2021年10月15日 GMT-4 14:20 Electromagnetics, LiveLink for MATLAB, Parameters, Variables, & Functions Version 5.6 3 Replies
Please login with a confirmed email address before reporting spam
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); %this is what they call base gap Electrode_height_str = num2str(Electrode_height_val); %this is what they call electrode thickness
%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?