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.
Pass a 1D array (vector) to a MATLAB function in COMSOL with MATLAB
Posted 13.02.2023, 08:49 GMT-5 LiveLink for MATLAB, Materials, Modeling Tools & Definitions Version 5.5 1 Reply
Please login with a confirmed email address before reporting spam
I am trying to define the material properties (permittivity and conductivity) with MATLAB functions. The functions have six input arguments. Of the six, first two are usual COMSOL coordinate variables x
and y
. The next three are vectors (1D array) and the sixth one is a scalar.
My approach:
I tried to define the last four variables using the model.param.set()
method like following:
model.param.set('x1', x1); % x1 is a vector
model.param.set('y1', y1); % y1 is a vector
model.param.set('epsr1', epsr1); % epsr is a vector
model.param.set('del', del); % del is a scalar
Then I would define the material property as following:
model.component('comp1').material('mat2').propertyGroup('def').set('relpermittivity', {'mat_epsr(x,y,x1,y1,epsr_array,del_c)'}); % mat_epsr is the function
Unfortunately, this throws an error for trying to set an array as a parameter in COMSOL. The error message is as follows:
No method 'set' with matching signature found for class 'com.comsol.clientapi.impl.ModelParamClient'.
Error in (line 36) model.param.set('x1', x1);
How may I solve this error? I appreciate your help a lot.
-------------------Md. Al-Imran Abir