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.

Comsol with Matlab: treat a Matlab-Vector from Workspace as Function

Please login with a confirmed email address before reporting spam

Hello,

I want to use Comsol in Matlab, because most of my previous calculations have been done there. My question is now, how to import my solutions into the Comsol-Model.

The vector Yi includes all my solutions depending of the time. For the first test, I defined a point in Comsol, which should have my solution as voltage.

My first try was this one:

pnt.V0 = {0,'Yi(ceil(t/0.00001)+1)'};

but Matlab gave back the error-message, that Yi wasn't defined in Comsol. So my question is now, how I can define it. In my opinion, I could use this code:

clear fcns
fcns{1}.type='interp';
fcns{1}.name='Yi';
fcns{1}.method='neighbor';
fcns{1}.extmethod='interior';
fcns{1}.x={0:Ts:10};
fcns{1}.data={Yi};
fem.functions = fcns;

but it didn't work out. It's my first time with comsol in Matlab but the Matlab Interface Guide and the Search function were not able to help me.

Thank you very much for your fast answers.

0 Replies Last Post 2010年3月1日 GMT-5 15:12
COMSOL Moderator

Hello Ulf Zimmermann

Your Discussion has gone 30 days without a reply. If you still need help with COMSOL and have an on-subscription license, please visit our Support Center for help.

If you do not hold an on-subscription license, you may find an answer in another Discussion or in the Knowledge Base.

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.