Note: This discussion is about an older version of the COMSOL Multiphysics® software. The information provided may be out of date.

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.

access solutions from COMSOL in MATLAB

Please login with a confirmed email address before reporting spam

Hi,

I would like to run comsol in matlab, and save the solutions of some variables in matlab for further calculation. Take a plain strain model for example, I need the solutions of deformation (u, v) at certain bounday, that is (u,v) values at all mesh points, rather than an integration value. Also I do not want to save the solutions in a txt file and load them into matlab, because I need to do comsol script for 100 times in a loop that I cannot save them every time.

I am using comsol v3.5a and matlab 7.9.0.

many thanks for any help!


1 Reply Last Post 4 juil. 2011, 13:06 UTC−4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 4 juil. 2011, 13:06 UTC−4
I have solved this problem using the command 'postinterp' thanks to some previous related discussion in this forum.

In case someone may need to solve similar problems, I attached an example code here.

px=linspace(0,1,101); % x coordinate
py=linspace(0,0,101); % y coordinate
p=[px;py]; % p gives coordinate of 100 points
[v]=postinterp(fem,'v',p); % v is the the values of variable 'v' in solution 'fem' at the 100 points
I have solved this problem using the command 'postinterp' thanks to some previous related discussion in this forum. In case someone may need to solve similar problems, I attached an example code here. px=linspace(0,1,101); % x coordinate py=linspace(0,0,101); % y coordinate p=[px;py]; % p gives coordinate of 100 points [v]=postinterp(fem,'v',p); % v is the the values of variable 'v' in solution 'fem' at the 100 points

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.