How Can I Import and use Position-Dependent Variables Into Comsol Matlab Code

3 views (last 30 days)
I am using Comsol with Matlab livelink. Please, find my attached Matlab code. Directly in Comsol matlab code, I computed phi0 which gives the initial values of variable phi on each of the nodes (line 134-156). I used the mesh discretization of 40 by 80 which gives a total nodes of 41*81. And the code runs completely.
Now, using the same discretization, I computed phi0 with another code (line 8-42), which I assigned to phi3 (line 46 and 47). I inputed phi3 as phi0 in Comsol (line 157). I have the coordinates of each nodes and their corresponding phi3.
I used num2str in line 157 to assigned phi3 as phi0 which includes the x and y coordinates of each node and their corresponding phi0 (line 46) but the code gave error.
I also used line 47 which contains only phi3, without x and y coordinates. But the code also gave error.
It also gave error when I exported phi0 from Comsol and I tried to plug the exported phi0 back into Comsol.
Error message:
Error in multiphysics compilation. Syntax error in expression.
Please, help me. How can I use calculated phi0 ( position-dependent variable) obtained from external source on each of the nodes of a Comsol model directly from the Matlab code generated from the model? I have the x and y coordinates of each of the nodes and the corresponding phi0.

Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Products


Release

R2018b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!