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.
Create arbitrary distribution of circles via Livelink for Matlab
Posted 17 mai 2011, 17:03 UTC−4 Geometry Version 4.1, Version 4.2 1 Reply
Please login with a confirmed email address before reporting spam
First of all, since i am very new to this discussion forum please excuse any 'unclearness' in the way i will try to express my problem.
I am currently using the matlab livelink feature of comsol 4.1 for creating a 2D geometry that consists of arbitrarily posistioned circles.
The way i am trying to do this is by the following matlab script:
model = ModelUtil.create('Model');
geom1 = model.geom.create('geom1',2);
index=1
x=randi([-100 100],30,1)
y=randi([-100 100],30,1)
index
for i=1:1:size(x,1)
c(i)= geom2.feature.create((strcat('c',i)),'Circle');
c(i).set('r',1);
c(i).set('pos',[x(i) y(i)]);
geom2.run;
index=index+1
end
geom2.run;
mphgeom(model,'geom2');
1) I really do not understand why each geometric element has to be under a different variable name.Right now i am incorporating all my circles inside the matrix called c and i do not know if this is correct.
2) If i run the same script with
x=randi([-100 100],40,1)
y=randi([-100 100],40,1) instead of
x=randi([-100 100],30,1)
y=randi([-100 100],30,1)
then i get an error on the geom2.run function that i also cannot explain.
Hello Orestis Vardoulis
Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.
If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.