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.
loop to creat the geometry
Posted 24 janv. 2014, 17:54 UTC−5 Geometry Version 4.3b 0 Replies
Please login with a confirmed email address before reporting spam
I am using comsol-matlab to creat geometry by loop, but the geometry can only plot the last curve. is there anyone know why and how to cope with this.
thanks and looking forward to your reply!
br,
logan
clear all
close all
import com.comsol.model.*
import com.comsol.model.util.*
model = ModelUtil.create('Model');
model.modelNode.create('mod1');
model.geom.create('geom1', 2);
model.mesh.create('mesh1', 'geom1');
model.physics.create('emw', 'ElectromagneticWaves', 'geom1');
model.study.create('std1');
model.study('std1').feature.create('freq', 'Frequency');
model.study('std1').feature('freq').activate('emw', true);
model.param.set('delatl', '2e-3');
model.param.set('ratio_h', '0.4');
model.param.set('m', '25');
for n=1:25
model.param.set('m', num2str(n));
num2str(n);
model.geom('geom1').feature.create(num2str(n), 'BezierPolygon');
model.geom('geom1').feature(num2str(n)).set('type', 'solid');
model.geom('geom1').feature(num2str(n)).set('p', {'0.003' 'delatl*ratio_h+0.003' '0.003';'-0.025+(m-1)*delatl' '-0.025+m*delatl' '-0.025+m*delatl'});
model.geom('geom1').feature(num2str(n)).set('w', {'1' '1' '1' '1'});
model.geom('geom1').feature(num2str(n)).set('degree', [1 1]);
hold on
end
model.geom('geom1').runAll;
mphgeom(model)
ylim([-0.03 0.03])
% % % % % % for n=1:25
% % % % % % model.param.set('m', num2str(n));
% % % % % % num2str(n);
% % % % % % model.geom('geom1').feature.create(num2str(n), 'BezierPolygon');
% % % % % % model.geom('geom1').feature(num2str(n)).set('type', 'solid');
% % % % % % model.geom('geom1').feature(num2str(n)).set('p', {'0.003' 'delatl*ratio_h+0.003' '0.003';'-0.025+(m-1)*delatl' '-0.025+m*delatl' '-0.025+m*delatl'});
% % % % % % model.geom('geom1').feature(num2str(n)).set('w', {'1' '1' '1' '1'});
% % % % % % model.geom('geom1').feature(num2str(n)).set('degree', [1 1]);
% % % % % % hold on
% % % % % % model.geom('geom1').runAll;
% % % % % % mphgeom(model)
% % % % % % end
% % % % % % ylim([-0.03 0.03])
Hello Logan Bao
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.