Hi,
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])
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])