MATLAB Answers

comsol model to matlab function

83 views (last 30 days)
george veropoulos
george veropoulos on 11 Jul 2016
Answered: Suresh Palani on 7 Aug 2019
I have a comsol model with various inpute parameters and output the variable Te, Tl it is possible to make a matlab function based in comsol model... ? thank you George

  0 Comments

Sign in to comment.

Answers (2)

argo yang
argo yang on 29 Aug 2018
you can use the following command to load a comsol model into matlab in Comsol with matlab model = mphload('test_rec.mph')

  0 Comments

Sign in to comment.


Suresh Palani
Suresh Palani on 7 Aug 2019
Hi,
I am not sure if you have figured out the solution to your query. In case if you haven't.
If your output is "alpha" and the function with the comsol model is "Objfun".
If your input variables are x,y,z......
Then in your main script
model = mphload('File name');
mphlaunch(model);
x='value';y='value';z='value' (Note x,y,z can be a vector too)
alpha = Objfun(x,y,z,...,model);
Then in your function script
function alpha = Objfun(x,y,z,...,model)
...........
model.param.set('parameter name', x);
model.param.set('parameter name', y);
model.param.set('parameter name', z);
...........
end

  0 Comments

Sign in to comment.

Sign in to answer this question.