[請益] comsol with matlab 建模問題

作者: a913305 (中正杜蘭特)   2017-04-08 16:52:38
最近因為研究需要最佳化
使用COMSOL 5.0 with MATLAB
想要建很多個圓柱 不同位置的圓柱半徑大小有所不同
原本想說用matlab弄個for迴圈寫個判斷式就好
結果發現好像沒那麼容易
comsol指令似乎只能辨識字串
命名只要重複他就會出錯....所以也無法跑迴圈
有試過num2str指令也無法成功執行
不知板上有沒有高手能解決這個棘手的問題
部分程式碼
for i=1:10
cly=num2str;
model.geom('geom1').create('cly', 'Cylinder');
model.geom('geom1').feature('cly').set('pos', {'(10.5+i)*unitcell_length'
'0.5*unitcell_length' '0'});
model.geom('geom1').feature('cly').set('r', 'radius3');
model.geom('geom1').feature('cly').set('h', 'hight');
end
作者: ssslll (布立卡)   2017-04-26 18:24:00
如果不用迴圈,可以使用 array 來定義幾何3維的數量跟位移使用迴圈建立圓柱,再分別套用 array

Links booklink

Contact Us: admin [ a t ] ucptt.com