After installation of COMSOL, the Matlab path may be changed, for instance after update or re-installation. Now if you run COMOSOL with Matlab, there will be an error, or sth like that:
Category Archives: Maths
Particle swarm optimization: the simplest what and how
While there exist many introductory materials on Particle Swarm Optimization (PSO), it is best to have an intuitive example, simple, understandable at first reading, and illustrative. I personally do not like those examples that try to bring all intricacies together. Here comes the simplest example I guess: to find a minimum for the function:
It is know that the optimal solution is found when x=-1, and the minimum is f(x)=0;
The below video demonstrate the results of finding this optimal solution using PSO based approach:
As you can see, after some initial random movements of the design variables, the design variable gradually converges to x=-1 (the black curve) and the optimal value reaches 0.
mllapack.dll crashing problem: finally solved in Matlab 2010b
If you would like to call matlab functions in DotNet or com, and your function calls involve some functions which rely on lapack functions, and prior to Matlab 2010b, you may find that your program crashes. Tracing the problem, you will find this is due to a dll (mllapack.dll), and the problem is reported here, and here.
In Matlab 2010b, I have tested two functions which depend on the LAPACK, and it works now!
Download demo VS2010 project here.
Using .Net object in Matlab
Matlab ’s function is power, but not enough. Sometimes, you need some functionality from .net. One example is the Bezier curve class, which is absent in Matlab.
Matlab crashes during optimization and other function calls: trouble shooting
In programming Matlab, suddenly it crashes. Face it.
One of the occasion is when I call the norm function programmatically. In the interactive command window, there is no problem, but if you use it in script. Sorry, it just crashes, with a console window disappeared before you have time to read the details.
After Google searching, here is the solution, and it worked for me at least: add a system variable “KMP_DUPLICATE_LIB_OK” with its value set to “TRUE”.
COMSOL Multiphysics Programming Note (I)
• fem.equ—contains information about equations on subdomains
• fem.bnd—contains information belonging to boundaries
• fem.edg—in 3D, this field is related to edges (curves)
• fem.pnt—in 2D and 3D, this field corresponds to vertices (points)
• fem.ode—specifies ODEs and other scalar equations independent of position
Read the rest of this entry »
Common symbols in PDE terminology
The symbol
is the vector differential operator (gradient), defined as
The space coordinates are denoted x1, …, xn, where n represents the number of space dimensions.
• The symbol Δ stands for the Laplace operator
•
means
where β1 , … , βn are the components of the vector β.
Adapted from COMSOL Modeling Guide.
Using Matlab functions in C# (2009b)
Matlab has changed a bit of the command “deploytool” in 2009a and 2009b. To see how to use matlab functions in 2009a, see my previous post here.
In 2009b, this has changed a bit and this post will show you how to accomplish the same task in Matlab 2009b.