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.

Comparison between integration in COMSOL and MATLAB

Please login with a confirmed email address before reporting spam

I have an expresion I need to integrate. I have been integrating this expression in MATLAB. However I find that when I integrate the same expression in COMSOL I get a slightly different value (see image).
In COMSOL I calculate

FF = solid.freq*2*pi/2/(solid.Ws_tot)/solid.rho*d(solid.Ws,T), and
Cii = volume integral of { solid.rho*solid.freq*2*pi/2/(solid.Ws_tot)/solid.rho*d(solid.Ws,T)*solid.freq*2*pi/2/(solid.Ws_tot)/solid.rho*d(solid.Ws,T) }

and in MATLAB I calculate

Cii(i) = sum ( rho * meshvol .* FF(:,i) .* FF(:,i) );

where meshvol, rho and FF are those exported from COMSOL and i indexes eigenmodes.
Is there a method to get identical results?



1 Reply Last Post 11 juin 2018, 07:44 UTC−4
Lars Gregersen COMSOL Employee

Please login with a confirmed email address before reporting spam

Posted: 6 years ago 11 juin 2018, 07:44 UTC−4

There is no easy way. Comsol uses the shape functions when integrating which gives a higher accuracy than summing in Matlab does.

There are no good ways to get the weights that Comsol uses for improving the integration in Matlab (or other tools). Why can't you simply use the integration from Comsol?

-------------------
Lars Gregersen
Comsol Denmark
There is no easy way. Comsol uses the shape functions when integrating which gives a higher accuracy than summing in Matlab does. There are no good ways to get the weights that Comsol uses for improving the integration in Matlab (or other tools). Why can't you simply use the integration from Comsol?

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.