Use MATLAB 'for loop' to iterate the boundary loading

Please login with a confirmed email address before reporting spam

Hi I understand changing the last item '2222' in the following code can redifine the boundary loading in terms of pressure: model.physics('solid').feature('bndl1').set('FollowerPressure', '2222'); In my case, I got 13 different values of the boundary pressure and hence I was wondering is there anyway to use MATLAB 'for' loop function to execute all the values at one time? Thanks for your time Best wishes J


1 Reply Last Post Nov 5, 2020, 7:26 AM EST
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 3 weeks ago Nov 5, 2020, 7:26 AM EST

Hi

Of course there is. Somethis like this:

% load your model using mphopen
values = [22 33 222 333 2222 3333]; % etc.
for i=1:length(values)
  model.physics('solid').feature('bndl1').set('FollowerPressure', values(i));
  model.study('std1').run
  % extract data and make plots
end
-------------------
Lars Gregersen
Comsol Denmark
Hi Of course there is. Somethis like this: % load your model using mphopen values = [22 33 222 333 2222 3333]; % etc. for i=1:length(values) model.physics('solid').feature('bndl1').set('FollowerPressure', values(i)); model.study('std1').run % extract data and make plots end

Reply

Please read the discussion forum rules before posting.

Please log in to post a reply.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.